当前位置: 首页>>代码示例>>Java>>正文


Java FluidRegistry.getFluid方法代码示例

本文整理汇总了Java中net.minecraftforge.fluids.FluidRegistry.getFluid方法的典型用法代码示例。如果您正苦于以下问题:Java FluidRegistry.getFluid方法的具体用法?Java FluidRegistry.getFluid怎么用?Java FluidRegistry.getFluid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.fluids.FluidRegistry的用法示例。


在下文中一共展示了FluidRegistry.getFluid方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: postInit

import net.minecraftforge.fluids.FluidRegistry; //导入方法依赖的package包/类
@Override
public void postInit() {
    Fluid hootch = FluidRegistry.getFluid("hootch");
    Fluid rocketFuel = FluidRegistry.getFluid("rocket_fuel");
    Fluid fireWater = FluidRegistry.getFluid("fire_water");

    if (hootch != null) {
        PneumaticRegistry.getInstance().registerFuel(hootch, 60 * 6000);
    } else {
        Log.warning("Couldn't find a fluid with name 'hootch' even though EnderIO is in the instance. It hasn't been registered as fuel!");
    }
    if (rocketFuel != null) {
        PneumaticRegistry.getInstance().registerFuel(rocketFuel, 160 * 7000);
    } else {
        Log.warning("Couldn't find a fluid with name 'rocket_fuel' even though EnderIO is in the instance. It hasn't been registered as fuel!");
    }
    if (fireWater != null) {
        PneumaticRegistry.getInstance().registerFuel(fireWater, 80 * 15000);
    } else {
        Log.warning("Couldn't find a fluid with name 'fire_water' even though EnderIO is in the instance. It hasn't been registered as fuel!");
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:23,代码来源:EnderIO.java

示例2: init

import net.minecraftforge.fluids.FluidRegistry; //导入方法依赖的package包/类
@Override
public void init() {
    // gasoline is equivalent to Thermal Foundation refined fuel @ 2,000,000
    // "oil" gets added by CoFH so no need to do it here
    ThermalExpansionHelper.addCompressionFuel(Fluids.DIESEL.getName(), 1000000);
    ThermalExpansionHelper.addCompressionFuel(Fluids.KEROSENE.getName(), 1500000);
    ThermalExpansionHelper.addCompressionFuel(Fluids.GASOLINE.getName(), 2000000);
    ThermalExpansionHelper.addCompressionFuel(Fluids.LPG.getName(), 2500000);
    PneumaticCraftRepressurized.logger.info("Added PneumaticCraft: Repressurized fuels to CoFH Compression Dynamo");

    registerCoFHfuel("creosote", 75000);
    registerCoFHfuel("coal", 300000);
    registerCoFHfuel("tree_oil", 750000);
    registerCoFHfuel("refined_oil", 937500);
    registerCoFHfuel("refined_fuel", 1500000);

    Fluid crudeOil = FluidRegistry.getFluid("crude_oil");
    if (crudeOil != null) {
        PneumaticCraftAPIHandler.getInstance().registerRefineryInput(crudeOil);
        PneumaticCraftRepressurized.logger.info("Added CoFH Crude Oil as a Refinery input");
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:23,代码来源:CoFHCore.java

示例3: validateFluids

import net.minecraftforge.fluids.FluidRegistry; //导入方法依赖的package包/类
@EventHandler
public void validateFluids(FMLServerStartedEvent event) {
    if (ConfigHandler.general.oilGenerationChance > 0) {
        Fluid oil = FluidRegistry.getFluid(Fluids.OIL.getName());
        if (oil.getBlock() == null) {
            String modName = FluidRegistry.getDefaultFluidName(oil).split(":")[0];
            Log.error(String.format("Oil fluid does not have a block associated with it. The fluid is owned by [%s]. " +
                    "This might be fixable by creating the world with having this mod loaded after PneumaticCraft.", modName));
            Log.error(String.format("This can be done by adding a injectedDependencies.json inside the config folder containing: " +
                    "[{\"modId\": \"%s\",\"deps\": [{\"type\":\"after\",\"target\":\"%s\"}]}]", modName, Names.MOD_ID));
            Log.error(String.format("Alternatively, you can disable PneumaticCraft oil generation by setting 'D:oilGenerationChance=0.0' " +
                    "in the config file pneumaticcraft.cfg, and use the the oil from [%s].", modName));
            throw new IllegalStateException("Oil fluid does not have a block associated with it (see errors above for more information)");
        }
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:17,代码来源:PneumaticCraftRepressurized.java

示例4: createFluid

import net.minecraftforge.fluids.FluidRegistry; //导入方法依赖的package包/类
private static <T extends Block & IFluidBlock> Fluid createFluid(String name, boolean hasFlowIcon, Consumer<Fluid> fluidPropertyApplier, Function<Fluid, T> blockFactory, boolean hasBucket) {
	final ResourceLocation still = new ResourceLocation(LibMod.MOD_ID + ":blocks/fluid/" + name + "_still");
	final ResourceLocation flowing = hasFlowIcon ? new ResourceLocation(LibMod.MOD_ID + ":blocks/fluid/" + name + "_flow") : still;

	Fluid fluid = new Fluid(name, still, flowing);
	final boolean useOwnFluid = FluidRegistry.registerFluid(fluid);

	if (useOwnFluid) {
		fluidPropertyApplier.accept(fluid);
		MOD_FLUID_BLOCKS.add(blockFactory.apply(fluid));
		if (hasBucket)
			FluidRegistry.addBucketForFluid(fluid);
	} else {
		fluid = FluidRegistry.getFluid(name);
	}

	return fluid;
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:19,代码来源:Fluids.java

示例5: registerFluids

import net.minecraftforge.fluids.FluidRegistry; //导入方法依赖的package包/类
public static void registerFluids(){
	if(!FluidRegistry.isFluidRegistered("creosote")){
		Creosote=new FluidCreosote("creosote", new ResourceLocation(Constants.MODID, "blocks/creosote_still"), new ResourceLocation(Constants.MODID, "blocks/creosote_flow"));
		Creosote.setViscosity(2000);
		FluidRegistry.registerFluid(Creosote);
		FluidRegistry.addBucketForFluid(Creosote);
		BlockCreosote=new BlockFluidCreosote();
		Creosote.setBlock(BlockCreosote);
	}else{
		Creosote=FluidRegistry.getFluid("creosote");
		if(Creosote.getBlock()==null){
			BlockCreosote=new BlockFluidCreosote();
			Creosote.setBlock(BlockCreosote);
		}
	}
}
 
开发者ID:EnderiumSmith,项目名称:CharcoalPit,代码行数:17,代码来源:FluidsRegistry.java

示例6: process

import net.minecraftforge.fluids.FluidRegistry; //导入方法依赖的package包/类
/**
 * Sets the liquid in the model.
 * fluid - Name of the fluid in the FluidRegistry
 * flipGas - If "true" the model will be flipped upside down if the liquid is a gas. If "false" it wont
 * <p/>
 * If the fluid can't be found, water is used
 */
@Override
public ModelDynBucket process(ImmutableMap<String, String> customData)
{
    String fluidName = customData.get("fluid");
    Fluid fluid = FluidRegistry.getFluid(fluidName);

    if (fluid == null) fluid = this.fluid;

    boolean flip = flipGas;
    if (customData.containsKey("flipGas"))
    {
        String flipStr = customData.get("flipGas");
        if (flipStr.equals("true")) flip = true;
        else if (flipStr.equals("false")) flip = false;
        else
            throw new IllegalArgumentException(String.format("DynBucket custom data \"flipGas\" must have value \'true\' or \'false\' (was \'%s\')", flipStr));
    }

    // create new model with correct liquid
    return new ModelDynBucket(baseLocation, liquidLocation, coverLocation, fluid, flip);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:29,代码来源:ModelDynBucket.java

示例7: getAllFuels

import net.minecraftforge.fluids.FluidRegistry; //导入方法依赖的package包/类
private List<String> getAllFuels() {
    List<String> fuels = new ArrayList<String>();
    fuels.add("L/Bucket | Fluid");
    for (Map.Entry<String, Integer> map : sortByValue(PneumaticCraftAPIHandler.getInstance().liquidFuels).entrySet()) {
        String value = map.getValue() / 1000 + "";
        while (fontRenderer.getStringWidth(value) < 25) {
            value = value + " ";
        }
        Fluid fluid = FluidRegistry.getFluid(map.getKey());
        fuels.add(value + "| " + fluid.getLocalizedName(new FluidStack(fluid, 1)));
    }
    return fuels;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:14,代码来源:GuiLiquidCompressor.java

示例8: getFilterForArgs

import net.minecraftforge.fluids.FluidRegistry; //导入方法依赖的package包/类
private ProgWidgetLiquidFilter getFilterForArgs(String fluidName) throws IllegalArgumentException {
    Fluid fluid = FluidRegistry.getFluid(fluidName);
    if (fluid == null) throw new IllegalArgumentException("Can't find fluid for the name \"" + fluidName + "\"!");
    ProgWidgetLiquidFilter filter = new ProgWidgetLiquidFilter();
    filter.setFluid(fluid);
    return filter;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:8,代码来源:ProgWidgetCC.java

示例9: registerCoFHfuel

import net.minecraftforge.fluids.FluidRegistry; //导入方法依赖的package包/类
private void registerCoFHfuel(String fuelName, int mLPerBucket) {
    Fluid f = FluidRegistry.getFluid(fuelName);
    if (f != null) {
        PneumaticCraftAPIHandler.getInstance().registerFuel(f, mLPerBucket);
        PneumaticCraftRepressurized.logger.info("Added CoFH fuel '" + fuelName + "'");
    } else {
        PneumaticCraftRepressurized.logger.warn("Can't find CoFH fuel: " + fuelName);
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:10,代码来源:CoFHCore.java

示例10: fromBytes

import net.minecraftforge.fluids.FluidRegistry; //导入方法依赖的package包/类
@Override
public void fromBytes(ByteBuf buf) {
    super.fromBytes(buf);
    if (buf.readBoolean())
        settingStack = new FluidStack(FluidRegistry.getFluid(ByteBufUtils.readUTF8String(buf)), buf.readInt(), ByteBufUtils.readTag(buf));
    settingIndex = buf.readInt();
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:8,代码来源:PacketSetLogisticsFluidFilterStack.java

示例11: getFluidOrItemStack

import net.minecraftforge.fluids.FluidRegistry; //导入方法依赖的package包/类
public static Object getFluidOrItemStack(ByteBuf buf) {
    if (buf.readByte() == 0) {
        return ByteBufUtils.readItemStack(buf);
    } else {
        return new FluidStack(FluidRegistry.getFluid(ByteBufUtils.readUTF8String(buf)), buf.readInt(), ByteBufUtils.readTag(buf));
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:8,代码来源:PacketSyncAmadronOffers.java

示例12: readField

import net.minecraftforge.fluids.FluidRegistry; //导入方法依赖的package包/类
public static Object readField(ByteBuf buf, int type) {
    switch (type) {
        case 0:
            return buf.readInt();
        case 1:
            return buf.readFloat();
        case 2:
            return buf.readDouble();
        case 3:
            return buf.readBoolean();
        case 4:
            return ByteBufUtils.readUTF8String(buf);
        case 5:
            return buf.readByte();
        case 6:
            return ByteBufUtils.readItemStack(buf);
        case 7:
            if (!buf.readBoolean()) return null;
            return new FluidStack(FluidRegistry.getFluid(ByteBufUtils.readUTF8String(buf)), buf.readInt(), ByteBufUtils.readTag(buf));
        case 8:
            try {
                PacketBuffer packetBuffer = new PacketBuffer(buf);
                NBTTagCompound tag = packetBuffer.readCompoundTag();
                if (tag == null) return EmptyHandler.INSTANCE;
                ItemStackHandler handler = new ItemStackHandler();
                handler.deserializeNBT(tag);
                return handler;
            } catch (IOException e) {
                return EmptyHandler.INSTANCE;
            }
    }
    throw new IllegalArgumentException("Invalid sync type! " + type);
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:34,代码来源:PacketUpdateGui.java

示例13: readFromNBT

import net.minecraftforge.fluids.FluidRegistry; //导入方法依赖的package包/类
@Override
public void readFromNBT(NBTTagCompound tag) {
    super.readFromNBT(tag);
    redstoneMode = tag.getInteger("redstoneMode");
    feedMode = tag.getInteger("feedMode");
    setPlayer(tag.getString("playerName"), tag.getString("playerUUID"));
    if (tag.hasKey("curXpFluid")) curXpFluid = FluidRegistry.getFluid(tag.getString("curXpFluid"));
    if (energyRF != null) readRF(tag);

    dispenserUpgradeInserted = getUpgrades(EnumUpgrade.DISPENSER) > 0;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:12,代码来源:TileEntityAerialInterface.java

示例14: init

import net.minecraftforge.fluids.FluidRegistry; //导入方法依赖的package包/类
@EventHandler
public void init(FMLPostInitializationEvent event)
{
    ReactorInterior.registerFluid("ic2coolant", 0.66F, 0.95F, 6F, IHeatEntity.conductivityDiamond);
    ReactorInterior.registerFluid("ic2uu_matter", 0.9F, 0.99F, 18F, IHeatEntity.conductivityDiamond);

    Reactants.registerReactant("uFuel", 0, 0x46c81a);
    Reactants.registerReactant("plutonium", 1, 0xaaaaaa);
    ReactorConversions.register("uFuel", "plutonium");

    Reactants.registerSolid("uraniumFuel", "uFuel");
    Reactants.registerSolid("tinyPlutonium", "plutonium");
    Item uraniumFuel = Item.getByNameOrId("ic2:nuclear");
    if(uraniumFuel != null)
    {
        OreDictionary.registerOre("uraniumFuel", uraniumFuel);
        OreDictionary.registerOre("tinyPlutonium", new ItemStack(uraniumFuel, 1, 7));
    }
    else
    {
        OreDictionary.registerOre("tinyPlutonium", new ItemStack(Item.getByNameOrId("bigreactors:ingotMetals"), 0, 1));
    }

    Fluid fluidUranium = FluidRegistry.getFluid("uraniumfuel");
    if(fluidUranium != null)
        Reactants.registerFluid(fluidUranium, "uFuel");
}
 
开发者ID:joserobjr,项目名称:UraniumBigReactor,代码行数:28,代码来源:UraniumBigReactorMod.java

示例15: init

import net.minecraftforge.fluids.FluidRegistry; //导入方法依赖的package包/类
public static void init() {
	slimeknights.tconstruct.library.smeltery.CastingRecipe recipe;
	for (EnumType type : ItemCast.EnumType.VALUES) {
		ItemStack cast = ItemCast.getStack(type, 1);
		if (!Config.DISABLED_TOOLS.contains(type.getTool())) {
			int i = 0;
			for (HeadMaterial mat : Materials.head_registry.values()) {
				String reqMat = "stone";
				if(Config.DISABLED_MATERIALS.contains("stone")) reqMat = "flint";
				if (reqMat.equals(mat.getName())) {
					recipe = new slimeknights.tconstruct.library.smeltery.CastingRecipe(cast, RecipeMatch.of(new ItemStack(type.getItem(), 1, i)), FluidRegistry.getFluid("gold"), 144 * 2);
					slimeknights.tconstruct.library.TinkerRegistry.registerTableCasting(recipe);
					recipe = new slimeknights.tconstruct.library.smeltery.CastingRecipe(cast, RecipeMatch.of(new ItemStack(type.getItem(), 1, i)), FluidRegistry.getFluid("alubrass"), 144 * 2);
					slimeknights.tconstruct.library.TinkerRegistry.registerTableCasting(recipe);
					recipe = new slimeknights.tconstruct.library.smeltery.CastingRecipe(cast, RecipeMatch.of(new ItemStack(type.getItem(), 1, i)), FluidRegistry.getFluid("brass"), 144 * 2);
					slimeknights.tconstruct.library.TinkerRegistry.registerTableCasting(recipe);
				}
				ItemStack head = new ItemStack(type.getItem(), 1, i);
				Fluid fluid = FluidRegistry.getFluid(mat.getName());
				if (fluid != null && !Config.DISABLED_MATERIALS.contains(mat.getName()) && !mat.equals(ModMaterials.HEAD_STONE)) {
					CommonProxy.smelteryMaterials.add(mat);
					recipe = new slimeknights.tconstruct.library.smeltery.CastingRecipe(head, RecipeMatch.of(ItemCast.getStack(type, 1)), fluid, type.getCost());
					slimeknights.tconstruct.library.TinkerRegistry.registerTableCasting(recipe);
				}
				i++;
			}
		}
	}
}
 
开发者ID:the-realest-stu,项目名称:Adventurers-Toolbox,代码行数:30,代码来源:TConstructCompat.java


注:本文中的net.minecraftforge.fluids.FluidRegistry.getFluid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。