Java 类net.minecraftforge.fluids.Fluid 实例源码

项目:pnc-repressurized    文件:ProgWidgetLiquidInventoryCondition.java   
@Override
protected DroneAIBlockCondition getEvaluator(IDroneBase drone, IProgWidget widget) {
    return new DroneAIBlockCondition(drone, (ProgWidgetAreaItemBase) widget) {

        @Override
        protected boolean evaluate(BlockPos pos) {
            TileEntity te = drone.world().getTileEntity(pos);
            int count = 0;
            if (te != null && te.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null) ) {
                IFluidHandler handler = te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null);
                for (IFluidTankProperties prop : handler.getTankProperties()) {
                    FluidStack stack = prop.getContents();
                    if (stack != null) {
                        if (ProgWidgetLiquidFilter.isLiquidValid(stack.getFluid(), widget, 1)) {
                            count += stack.amount;
                        }
                    }
                }
            } else {
                Fluid fluid = FluidRegistry.lookupFluidForBlock(drone.world().getBlockState(pos).getBlock());
                if (fluid != null && ProgWidgetLiquidFilter.isLiquidValid(fluid, widget, 1) && FluidUtils.isSourceBlock(drone.world(), pos)) {
                    count += 1000;
                }
            }
            return ((ICondition) widget).getOperator() == ICondition.Operator.EQUALS ?
                    count == ((ICondition) widget).getRequiredCount() :
                    count >= ((ICondition) widget).getRequiredCount();
        }

    };
}
项目:ThermionicsWorld    文件:BlockFluidSimple.java   
public BlockFluidSimple(Fluid fluid, String name) {
    super(fluid,
            //ThermionicsWorld.MATERIAL_PAIN);
            Material.WATER);
    //this.opaque = true;
    //this.icons = icons;
    this.quantaPerBlock = 4;
    this.quantaPerBlockFloat = 4.0f;
    this.tickRate = 10; //density-based tickrate winds up really high

    this.setRegistryName(name);
    this.setUnlocalizedName("thermionics_world.fluid."+name);

    this.fluidDamage = new DamageSource("fluid."+fluid.getName()).setDamageBypassesArmor().setDamageIsAbsolute();
    //if (fluid.getTemperature() > SCALDING) damageAmount = 1 + (fluid.getTemperature() - SCALDING) / 20f;

    this.setDefaultState(blockState.getBaseState().withProperty(BlockFluidBase.LEVEL, 3));
}
项目:pnc-repressurized    文件:ClientProxy.java   
@Override
public void init() {
    for (Fluid fluid : Fluids.FLUIDS) {
        ModelLoader.setBucketModelDefinition(Fluids.getBucket(fluid));
    }

    ThirdPartyManager.instance().clientInit();

    RenderingRegistry.registerEntityRenderingHandler(EntityRing.class, RenderEntityRing.FACTORY);
    EntityRegistry.registerModEntity(RL("ring"), EntityRing.class, Names.MOD_ID + ".ring", 100, PneumaticCraftRepressurized.instance, 80, 1, true);

    registerModuleRenderers();

    Blockss.setupColorHandlers();
    BlockColorHandler.registerColorHandlers();
    ItemColorHandler.registerColorHandlers();

    super.init();
}
项目:pnc-repressurized    文件:GuiProgWidgetLiquidFilter.java   
private void addValidFluids() {

        List<Fluid> fluids = new ArrayList<Fluid>();

        for (Fluid fluid : FluidRegistry.getRegisteredFluids().values()) {
            if (fluid.getLocalizedName(new FluidStack(fluid, 1)).toLowerCase().contains(searchField.getText())) {
                fluids.add(fluid);
            }
        }
        fluids.sort(Comparator.comparing(Fluid::getName));

        scrollbar.setStates(Math.max(0, (fluids.size() - GRID_WIDTH * GRID_HEIGHT + GRID_WIDTH - 1) / GRID_WIDTH));

        int offset = scrollbar.getState() * GRID_WIDTH;
        for (IGuiWidget widget : widgets) {
            if (widget.getID() >= 0 && widget instanceof WidgetFluidFilter) {
                int idWithOffset = widget.getID() + offset;
                ((WidgetFluidFilter) widget).setFluid(idWithOffset >= 0 && idWithOffset < fluids.size() ? fluids.get(idWithOffset) : null);
            }
        }
    }
项目:pnc-repressurized    文件:CoFHCore.java   
@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");
    }
}
项目:pnc-repressurized    文件:EventHandlerPneumaticCraft.java   
@SubscribeEvent
public void onFillBucket(FillBucketEvent event) {
    RayTraceResult rtr = event.getTarget();
    if (rtr != null) {
        Block b = event.getWorld().getBlockState(rtr.getBlockPos()).getBlock();
        if (b instanceof IFluidBlock) {
            Fluid fluid = ((IFluidBlock) b).getFluid();
            ItemStack filled = FluidUtil.getFilledBucket(new FluidStack(fluid, 1000));
            if (!filled.isEmpty()) {
                event.setFilledBucket(FluidUtil.getFilledBucket(new FluidStack(fluid, 1000)));
                event.getWorld().setBlockToAir(rtr.getBlockPos());
                event.setResult(Result.ALLOW);
                if (TileEntityRefinery.isInputFluidValid(fluid, 4) && event.getEntityPlayer() instanceof EntityPlayerMP) {
                    AdvancementTriggers.OIL_BUCKET.trigger((EntityPlayerMP) event.getEntityPlayer());
                }
            }
        }
    }
}
项目:pnc-repressurized    文件:HeatExchangerManager.java   
public void init() {
    registerBlockExchanger(Blocks.ICE, 263, 500);
    registerBlockExchanger(Blocks.PACKED_ICE, 263, 500);
    registerBlockExchanger(Blocks.SNOW, 268, 1000);
    registerBlockExchanger(Blocks.TORCH, 1700, 100000);
    registerBlockExchanger(Blocks.FIRE, 1700, 1000);

    Map<String, Fluid> fluids = FluidRegistry.getRegisteredFluids();
    for (Fluid fluid : fluids.values()) {
        if (fluid.getBlock() != null) {
            registerBlockExchanger(fluid.getBlock(), fluid.getTemperature(), FLUID_RESISTANCE);
        }
    }
    registerBlockExchanger(Blocks.FLOWING_WATER, FluidRegistry.WATER.getTemperature(), 500);
    registerBlockExchanger(Blocks.FLOWING_LAVA, FluidRegistry.LAVA.getTemperature(), 500);
}
项目:Steam-and-Steel    文件:RenderGlassTank.java   
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) {
    if (modelId == renderID) {
        TileGlassFluidTank tank = (TileGlassFluidTank) world.getTileEntity(x, y, z);
        if (renderPass == 0) {
            if (tank.tank.getFluid() != null) {
                Fluid fluid = tank.tank.getFluid().getFluid();
                Utils.renderBlockByCompleteness(GrandFluidTank.renderblocks,fluid, world.getBlockMetadata(x, y, z), renderer, (double) tank.tank.getFluidAmount() / (double) tank.tank.getCapacity(), x, y, z);
            }
        }
        else if (renderPass == 1) {
            renderer.setRenderBounds(0, 0, 0, 1, 1, 1);
            renderer.renderStandardBlock(block, x, y, z);
            renderer.setRenderFromInside(true);
            renderer.setRenderBounds(0, 0, 0, 1, 1, 1);
            renderer.renderStandardBlock(block, x, y, z);
            renderer.setRenderFromInside(false);
        }
    }
    return true;
}
项目:FoodCraft-Reloaded    文件:FluidStackRenderer.java   
private void drawFluid(Minecraft minecraft, final int xPosition, final int yPosition, @Nullable FluidStack fluidStack) {
    if (fluidStack == null) {
        return;
    }
    Fluid fluid = fluidStack.getFluid();
    if (fluid == null) {
        return;
    }

    TextureAtlasSprite fluidStillSprite = getStillFluidSprite(minecraft, fluid);

    int fluidColor = fluid.getColor(fluidStack);

    int scaledAmount = (fluidStack.amount * height) / capacityMb;
    if (fluidStack.amount > 0 && scaledAmount < MIN_FLUID_HEIGHT) {
        scaledAmount = MIN_FLUID_HEIGHT;
    }
    if (scaledAmount > height) {
        scaledAmount = height;
    }

    drawTiledSprite(minecraft, xPosition, yPosition, width, height, fluidColor, scaledAmount, fluidStillSprite);
}
项目:Metalworks    文件:Registry.java   
@SubscribeEvent
public static void registerGeoBurnables(RegistryEvent.Register<IGeoburnable> event){
    IForgeRegistry<IGeoburnable> reg = event.getRegistry();
    reg.register(new BlockGeoburnable(Blocks.MAGMA, 40, 1));
    reg.register(new BlockGeoburnable(Blocks.FIRE, 80, 2){
        @Override
        public ItemStack getJEIIcon() {
            return new ItemStack(Items.FLINT_AND_STEEL);
        }
    });
    reg.register(new BlockGeoburnable(Blocks.LAVA, 160, 3){
        @Override
        public ItemStack getJEIIcon() {
            return FluidUtil.getFilledBucket(new FluidStack(FluidRegistry.LAVA, Fluid.BUCKET_VOLUME));
        }
    });
}
项目:CustomWorldGen    文件:FluidBucketWrapper.java   
protected void setFluid(Fluid fluid) {
    if (fluid == null)
    {
        container.deserializeNBT(new ItemStack(Items.BUCKET).serializeNBT());
    }
    else if (fluid == FluidRegistry.WATER)
    {
        container.deserializeNBT(new ItemStack(Items.WATER_BUCKET).serializeNBT());
    }
    else if (fluid == FluidRegistry.LAVA)
    {
        container.deserializeNBT(new ItemStack(Items.LAVA_BUCKET).serializeNBT());
    }
    else if (fluid.getName().equals("milk"))
    {
        container.deserializeNBT(new ItemStack(Items.MILK_BUCKET).serializeNBT());
    }
    else if (FluidRegistry.isUniversalBucketEnabled() && FluidRegistry.getBucketFluids().contains(fluid))
    {
        ItemStack filledBucket = UniversalBucket.getFilledBucket(ForgeModContainer.getInstance().universalBucket, fluid);
        container.deserializeNBT(filledBucket.serializeNBT());
    }
}
项目:pnc-repressurized    文件:TileEntityGasLift.java   
private boolean suckLiquid() {
    Block block = world.getBlockState(getPos().offset(EnumFacing.DOWN, currentDepth + 1)).getBlock();
    Fluid fluid = FluidRegistry.lookupFluidForBlock(block);
    if (fluid == null) {
        pumpingLake = null;
        return false;
    }

    FluidStack fluidStack = new FluidStack(fluid, 1000);
    if (tank.fill(fluidStack, false) == 1000) {
        if (pumpingLake == null) {
            findLake(block);
        }
        BlockPos curPos = null;
        boolean foundSource = false;
        while (pumpingLake.size() > 0) {
            curPos = pumpingLake.get(0);
            if (getWorld().getBlockState(curPos).getBlock() == block && FluidUtils.isSourceBlock(getWorld(), curPos)) {
                foundSource = true;
                break;
            }
            pumpingLake.remove(0);
        }
        if (pumpingLake.size() == 0) {
            pumpingLake = null;
        } else if (foundSource) {
            getWorld().setBlockToAir(curPos);
            tank.fill(fluidStack, true);
            addAir(-100);
            status = Status.PUMPING;
        }
    }
    return true;
}
项目:pnc-repressurized    文件:PneumaticCraftRepressurized.java   
@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)");
        }
    }
}
项目:Firma    文件:BaseLiquid.java   
public BaseLiquid(String fluidName, Consumer<Fluid> f, int col) {
    super(fluidName, new ResourceLocation(FirmaMod.MODID + ":blocks/water_still"), new ResourceLocation(FirmaMod.MODID + ":blocks/water_flow"));
    this.setUnlocalizedName(FirmaMod.MODID + ":fluid." + fluidName);
    FluidRegistry.registerFluid(this);
    f.accept(this);
    block = new BaseBlockLiquid(this, Material.WATER);
    block.setRegistryName(FirmaMod.MODID + ":fluid." + fluidName);
    block.setUnlocalizedName(FirmaMod.MODID + ":fluid." + fluidName);
    block.setCreativeTab(FirmaMod.blockTab);
    block.setLightOpacity(3);
    block.setLightLevel(0);

    GameRegistry.register(block);
    i = new ItemBlock(block);
    i.setRegistryName(FirmaMod.MODID+":fluid."+fluidName);
    i.setUnlocalizedName(FirmaMod.MODID+":fluid."+fluidName);
    GameRegistry.register(i);
    FirmaMod.allFluids.add(this);
    this.col = col;
}
项目:ModularMachinery    文件:HybridStackHelper.java   
private T matchFluidStack(Iterable<T> ingredients, T ingredientToMatch) {
    if(Iterables.isEmpty(ingredients)) {
        return null;
    }
    FluidStack stack = ingredientToMatch.asFluidStack();
    if(stack == null) {
        return null;
    }
    Fluid fluidMatch = stack.getFluid();
    for (T hybridFluid : ingredients) {
        FluidStack hybridFluidStack = hybridFluid.asFluidStack();
        if(hybridFluidStack == null) {
            continue;
        }
        if(hybridFluidStack.getFluid() == fluidMatch) {
            return hybridFluid;
        }
    }
    return null;
}
项目:CustomWorldGen    文件:ModelDynBucket.java   
/**
 * 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);
}
项目:Bewitchment    文件:Fluids.java   
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;
}
项目:Soot    文件:Registry.java   
public static void registerFluids()
{
    //For creating alcohol. All made in Melter, so very hot.
    FluidRegistry.registerFluid(BOILING_WORT = new Fluid("boiling_wort",new ResourceLocation(Soot.MODID,"blocks/wort"),new ResourceLocation(Soot.MODID,"blocks/wort_flowing")).setTemperature(500));
    FluidRegistry.registerFluid(BOILING_POTATO_JUICE = new Fluid("boiling_potato_juice",new ResourceLocation(Soot.MODID,"blocks/potato_juice"),new ResourceLocation(Soot.MODID,"blocks/potato_juice_flowing")).setTemperature(500));
    FluidRegistry.registerFluid(BOILING_WORMWOOD = new Fluid("boiling_wormwood",new ResourceLocation(Soot.MODID,"blocks/verdigris"),new ResourceLocation(Soot.MODID,"blocks/verdigris_flowing")).setTemperature(500));
    FluidRegistry.registerFluid(BOILING_BEETROOT_SOUP = new Fluid("boiling_beetroot_soup",new ResourceLocation(Soot.MODID,"blocks/beetroot_soup"),new ResourceLocation(Soot.MODID,"blocks/beetroot_soup_flowing")).setTemperature(500));
    //Alcohol itself. Cold.
    FluidRegistry.registerFluid(ALE = new Fluid("ale",new ResourceLocation(Soot.MODID,"blocks/ale"),new ResourceLocation(Soot.MODID,"blocks/ale_flowing")));
    FluidRegistry.registerFluid(VODKA = new Fluid("vodka",new ResourceLocation(Soot.MODID,"blocks/vodka"),new ResourceLocation(Soot.MODID,"blocks/vodka_flowing")));
    FluidRegistry.registerFluid(INNER_FIRE = new Fluid("inner_fire",new ResourceLocation(Soot.MODID,"blocks/inner_fire"),new ResourceLocation(Soot.MODID,"blocks/inner_fire_flowing")));
    FluidRegistry.registerFluid(UMBER_ALE = new Fluid("umber_ale",new ResourceLocation(Soot.MODID,"blocks/umber_ale"),new ResourceLocation(Soot.MODID,"blocks/umber_ale_flowing")));
    FluidRegistry.registerFluid(METHANOL = new Fluid("methanol",new ResourceLocation(Soot.MODID,"blocks/methanol"),new ResourceLocation(Soot.MODID,"blocks/methanol_flowing")));
    FluidRegistry.registerFluid(ABSINTHE = new Fluid("absinthe",new ResourceLocation(Soot.MODID,"blocks/absinthe"),new ResourceLocation(Soot.MODID,"blocks/absinthe_flowing")));
    //Alchemy Fluids
    FluidRegistry.registerFluid(MOLTEN_ANTIMONY = new FluidMolten("antimony",new ResourceLocation(Soot.MODID,"blocks/molten_antimony"),new ResourceLocation(Soot.MODID,"blocks/molten_antimony_flowing")));
    FluidRegistry.registerFluid(MOLTEN_SUGAR = new FluidMolten("sugar",new ResourceLocation(Soot.MODID,"blocks/molten_sugar"),new ResourceLocation(Soot.MODID,"blocks/molten_sugar_flowing")));
}
项目:FoodCraft-Reloaded    文件:EnumLoader.java   
/**
     * Attempt to register all entries from {@link #enumInstanceMap} to {@link ForgeRegistries}.
     * @see ForgeRegistries
     */
    public void register() {
        enumInstanceMap.forEach((instanceClass, enumMap) -> {
            if (IForgeRegistryEntry.class.isAssignableFrom(instanceClass))
                enumMap.values().stream().map(o -> (IForgeRegistryEntry<? extends IForgeRegistryEntry<?>>) o)
//                    .map(o -> new RegisterHandler(o))
                    .forEach(o -> {
//                    TODO RegisterManager.getInstance().putRegister(o);
                        if (o instanceof Item) {
                            ForgeRegistries.ITEMS.register((Item) o);
                            if (o instanceof OreDictated)
                                Arrays.stream(((OreDictated) o).getOreDictNames()).forEach(s -> OreDictionary.registerOre(s, (Item) o));
                        }
                        else if (o instanceof Block) {
                            ForgeRegistries.BLOCKS.register((Block) o);
                            if (o instanceof OreDictated)
                                Arrays.stream(((OreDictated) o).getOreDictNames()).forEach(s -> OreDictionary.registerOre(s, (Block) o));
                        }
                    });
            else if (Fluid.class.isAssignableFrom(instanceClass))
                enumMap.values().stream().map(o -> (Fluid) o).forEach(fluid -> {
                    FluidRegistry.registerFluid(fluid);
                    FluidRegistry.addBucketForFluid(fluid);
                });
        });
    }
项目:CustomWorldGen    文件:FluidBucketWrapper.java   
@Nullable
public FluidStack getFluid()
{
    Item item = container.getItem();
    if (item == Items.WATER_BUCKET)
    {
        return new FluidStack(FluidRegistry.WATER, Fluid.BUCKET_VOLUME);
    }
    else if (item == Items.LAVA_BUCKET)
    {
        return new FluidStack(FluidRegistry.LAVA, Fluid.BUCKET_VOLUME);
    }
    else if (item == Items.MILK_BUCKET)
    {
        return FluidRegistry.getFluidStack("milk", Fluid.BUCKET_VOLUME);
    }
    else if (item == ForgeModContainer.getInstance().universalBucket)
    {
        return ForgeModContainer.getInstance().universalBucket.getFluid(container);
    }
    else
    {
        return null;
    }
}
项目:ThermionicsWorld    文件:TWBlocks.java   
public static BlockFluidSimple fluidBlock(IForgeRegistry<Block> registry, Fluid f) {
    FluidRegistry.registerFluid(f);
    BlockFluidSimple result = block(registry, new BlockFluidSimple(f, f.getName()));
    f.setBlock(result);
    FluidRegistry.addBucketForFluid(f);
    return result;
}
项目:customstuff4    文件:BlockFluid.java   
static Fluid createFluid(ContentBlockFluid content)
{
    Fluid fluid = new Fluid(content.id, content.texStill, content.texFlowing);
    fluid.setDensity(content.density);
    fluid.setTemperature(content.temperature);
    fluid.setGaseous(content.isGaseous);
    fluid.setViscosity(content.viscosity);
    fluid.setLuminosity(content.light.get(0).orElse(0));

    FluidRegistry.registerFluid(fluid);
    return fluid;
}
项目:Bewitchment    文件:BlockFluid.java   
public BlockFluid(Fluid fluid, int flammability, boolean flammable, Material liquid) {
    super(fluid, liquid);
    setUnlocalizedName(fluid.getName());
    setRegistryName(LibMod.MOD_ID, fluid.getName());
    setDensity(fluid.getDensity());

    this.flammability = flammability;
    this.flammable = flammable;
}
项目:pnc-repressurized    文件:EnderIO.java   
private void registerFuel(Fluid fluid, int powerPerCycle, int burnTime) {
    NBTTagCompound tag = new NBTTagCompound();
    tag.setString("fluidName", fluid.getName());
    tag.setInteger("powerPerCycle", powerPerCycle);
    tag.setInteger("totalBurnTime", burnTime);
    FMLInterModComms.sendMessage(ModIds.EIO, "fluidFuel:add", tag);
}
项目:pnc-repressurized    文件:ProgWidgetCC.java   
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;
}
项目:pnc-repressurized    文件:CoFHCore.java   
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);
    }
}
项目:pnc-repressurized    文件:DroneAILiquidImport.java   
private boolean emptyTank(BlockPos pos, boolean simulate) {
    if (drone.getTank().getFluidAmount() == drone.getTank().getCapacity()) {
        drone.addDebugEntry("gui.progWidget.liquidImport.debug.fullDroneTank");
        abort();
        return false;
    } else {
        TileEntity te = drone.world().getTileEntity(pos);
        if (te != null) {
            for (int i = 0; i < 6; i++) {
                if (((ISidedWidget) widget).getSides()[i] && te.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, EnumFacing.getFront(i))) {
                    IFluidHandler handler = te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, EnumFacing.getFront(i));
                    FluidStack importedFluid = handler.drain(Integer.MAX_VALUE, false);
                    if (importedFluid != null && ((ILiquidFiltered) widget).isFluidValid(importedFluid.getFluid())) {
                        int filledAmount = drone.getTank().fill(importedFluid, false);
                        if (filledAmount > 0) {
                            if (((ICountWidget) widget).useCount())
                                filledAmount = Math.min(filledAmount, getRemainingCount());
                            if (!simulate) {
                                decreaseCount(drone.getTank().fill(handler.drain(filledAmount, true), true));
                            }
                            return true;
                        }
                    }
                }
            }
            drone.addDebugEntry("gui.progWidget.liquidImport.debug.emptiedToMax", pos);
        } else if (!((ICountWidget) widget).useCount() || getRemainingCount() >= 1000) {
            Fluid fluid = FluidRegistry.lookupFluidForBlock(drone.world().getBlockState(pos).getBlock());
            if (fluid != null && ((ILiquidFiltered) widget).isFluidValid(fluid) && drone.getTank().fill(new FluidStack(fluid, 1000), false) == 1000 && FluidUtils.isSourceBlock(drone.world(), pos)) {
                if (!simulate) {
                    decreaseCount(1000);
                    drone.getTank().fill(new FluidStack(fluid, 1000), true);
                    drone.world().setBlockToAir(pos);
                }
                return true;
            }
        }
        return false;
    }
}
项目:pnc-repressurized    文件:HeatBehaviourLiquid.java   
public Fluid getFluid() {
    Fluid fluid = FluidRegistry.lookupFluidForBlock(getBlockState().getBlock());
    if (fluid != null) return fluid;
    else if (getBlockState().getBlock() == Blocks.FLOWING_LAVA) return FluidRegistry.LAVA;
    else if (getBlockState().getBlock() == Blocks.FLOWING_WATER) return FluidRegistry.WATER;
    return null;
}
项目:pnc-repressurized    文件:BlockFluidEtchingAcid.java   
public BlockFluidEtchingAcid(Fluid fluid) {
    super(fluid, new MaterialLiquid(MapColor.EMERALD) {
        @Override
        public EnumPushReaction getMobilityFlag() {
            return EnumPushReaction.DESTROY;
        }
    });
}
项目:CustomWorldGen    文件:BlockLiquidWrapper.java   
@Override
public IFluidTankProperties[] getTankProperties()
{
    FluidStack containedStack = null;
    IBlockState blockState = world.getBlockState(blockPos);
    if (blockState.getBlock() == blockLiquid)
    {
        containedStack = getStack(blockState);
    }
    return new FluidTankProperties[]{new FluidTankProperties(containedStack, Fluid.BUCKET_VOLUME, false, true)};
}
项目:Adventurers-Toolbox    文件:TConstructCompat.java   
public static void preInit() {
    //Add soulforged steel as a liquid
    if (Loader.isModLoaded("betterwithmods")) {
        Fluid soulforgedSteel = new Fluid("soulforged_steel", new ResourceLocation("tconstruct:blocks/fluids/molten_metal"), new ResourceLocation("tconstruct:blocks/fluids/molten_metal_flow"));
        FluidRegistry.registerFluid(soulforgedSteel);
        FluidRegistry.addBucketForFluid(soulforgedSteel);

        NBTTagCompound tag = new NBTTagCompound();
        tag.setString("fluid", soulforgedSteel.getName());
        tag.setString("ore", "SoulforgedSteel");
        tag.setBoolean("toolforge", false);
        FMLInterModComms.sendMessage("tconstruct", "integrateSmeltery", tag);
    }
}
项目:pnc-repressurized    文件:PneumaticCraftAPIHandler.java   
@Override
@Deprecated
public void registerRefineryInput(Fluid fluid) {
    // Register old refinery mapping for compatibility 
    PneumaticRecipeRegistry registry = PneumaticRecipeRegistry.getInstance();
    registry.registerRefineryRecipe(new FluidStack(fluid, 10), new FluidStack(Fluids.DIESEL, 4), new FluidStack(Fluids.LPG, 2));
    registry.registerRefineryRecipe(new FluidStack(fluid, 10), new FluidStack(Fluids.DIESEL, 2), new FluidStack(Fluids.KEROSENE, 3), new FluidStack(Fluids.LPG, 2));
    registry.registerRefineryRecipe(new FluidStack(fluid, 10), new FluidStack(Fluids.DIESEL, 2), new FluidStack(Fluids.KEROSENE, 3), new FluidStack(Fluids.GASOLINE, 3), new FluidStack(Fluids.LPG, 2));
}
项目:pnc-repressurized    文件:PneumaticCraftAPIHandler.java   
@Override
public void registerFuel(Fluid fluid, int mLPerBucket) {
    if (fluid == null) throw new NullPointerException("Fluid can't be null!");
    if (mLPerBucket < 0) throw new IllegalArgumentException("mLPerBucket can't be < 0");
    if (liquidFuels.containsKey(fluid.getName())) {
        Log.info("Overriding liquid fuel entry " + fluid.getLocalizedName(new FluidStack(fluid, 1)) + " (" + fluid.getName() + ") with a fuel value of " + mLPerBucket + " (previously " + liquidFuels.get(fluid.getName()) + ")");
        if (mLPerBucket == 0) liquidFuels.remove(fluid.getName());
    }
    if (mLPerBucket > 0) liquidFuels.put(fluid.getName(), mLPerBucket);
}
项目:pnc-repressurized    文件:TileEntityKeroseneLamp.java   
private void recalculateFuelQuality() {
    if (tank.getFluid() != null && tank.getFluid().amount > 0) {
        if (ConfigHandler.machineProperties.keroseneLampCanUseAnyFuel) {
            Fluid f = tank.getFluid().getFluid();
            // 110 comes from kerosene's fuel value of 1,100,000 divided by the old FUEL_PER_MB value (10000)
            fuelQuality = PneumaticCraftAPIHandler.getInstance().liquidFuels.getOrDefault(f.getName(), 0) / 110;
        } else {
            fuelQuality = Fluids.areFluidsEqual(tank.getFluid().getFluid(), Fluids.KEROSENE) ? 10000 : 0;
        }
        fuelQuality *= ConfigHandler.machineProperties.keroseneLampFuelEfficiency;
    }
}
项目:pnc-repressurized    文件:SemiBlockLogistics.java   
public int getIncomingFluid(Fluid fluid) {
    int count = 0;
    for (FluidStackWrapper wrapper : incomingFluid.keySet()) {
        if (wrapper.stack.getFluid() == fluid) count += wrapper.stack.amount;
    }
    return count;
}
项目:BetterThanWeagles    文件:ModFluids.java   
private static Fluid createFluid(String fluidName, ResourceLocation stillTexture, ResourceLocation flowTexture)
{
    Fluid fluid = new Fluid(fluidName, stillTexture, flowTexture);
    FluidRegistry.registerFluid(fluid);

    fluid.setDensity(800).setViscosity(1500);

    return fluid;
}
项目:Bewitchment    文件:TileEntityBarrel.java   
public void refreshRecipeStatus(BarrelRecipe incomingRecipe) {
    if (incomingRecipe != null) {
        ItemStack recipeOutput = inv.getStackInSlot(0);
        if (recipeOutput.isEmpty() || recipeOutput.getMaxStackSize() >= recipeOutput.getCount() + incomingRecipe.getResult().getCount()) {
            internalTank.drain(Fluid.BUCKET_VOLUME, true);
            this.cachedRecipe = incomingRecipe;
            this.recipeName = incomingRecipe.getRegistryName().toString();
            powerRequired = cachedRecipe.getPower();
            timeRequired = cachedRecipe.getRequiredTime();
            markDirty();
        }
    }
}
项目:Steam-and-Steel    文件:Utils.java   
public static void renderInventoryBlock(RenderBlocks renderblocks, Block block, Fluid fluid) {

    Tessellator tessellator = Tessellator.instance;
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, -1F, 0.0F);
    renderblocks.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, getValidIIcon(fluid.getIcon()));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 1.0F, 0.0F);
    renderblocks.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, getValidIIcon(fluid.getIcon()));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, -1F);
    renderblocks.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, getValidIIcon(fluid.getIcon()));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(0.0F, 0.0F, 1.0F);
    renderblocks.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, getValidIIcon(fluid.getIcon()));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(-1F, 0.0F, 0.0F);
    renderblocks.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, getValidIIcon(fluid.getIcon()));
    tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.setNormal(1.0F, 0.0F, 0.0F);
    renderblocks.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, getValidIIcon(fluid.getIcon()));
    tessellator.draw();
    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
项目:UraniumBigReactor    文件:UraniumBigReactorMod.java   
@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");
}
项目:Bewitchment    文件:TileCauldron.java   
@SuppressWarnings("ConstantConditions")
@Override
public void onLiquidChange() {
    ingredients.clear();
    mode = Mode.NORMAL;
    ritual = null;
    Fluid fluid = inv.getInnerFluid();
    if (fluid != null) {
        int color = (fluid == FluidRegistry.WATER || fluid.getColor() == 0xFFFFFFFF) ? 0x12193b : fluid.getColor();
        setColorRGB(color);
    }
    if (!world.isRemote)
        PacketHandler.updateToNearbyPlayers(world, pos);
}