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


Java Fluid类代码示例

本文整理汇总了Java中net.minecraftforge.fluids.Fluid的典型用法代码示例。如果您正苦于以下问题:Java Fluid类的具体用法?Java Fluid怎么用?Java Fluid使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: init

import net.minecraftforge.fluids.Fluid; //导入依赖的package包/类
@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();
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:20,代码来源:ClientProxy.java

示例2: getEvaluator

import net.minecraftforge.fluids.Fluid; //导入依赖的package包/类
@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();
        }

    };
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:32,代码来源:ProgWidgetLiquidInventoryCondition.java

示例3: BlockFluidSimple

import net.minecraftforge.fluids.Fluid; //导入依赖的package包/类
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));
}
 
开发者ID:elytra,项目名称:ThermionicsWorld,代码行数:19,代码来源:BlockFluidSimple.java

示例4: addValidFluids

import net.minecraftforge.fluids.Fluid; //导入依赖的package包/类
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);
            }
        }
    }
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:22,代码来源:GuiProgWidgetLiquidFilter.java

示例5: init

import net.minecraftforge.fluids.Fluid; //导入依赖的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

示例6: onFillBucket

import net.minecraftforge.fluids.Fluid; //导入依赖的package包/类
@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());
                }
            }
        }
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:20,代码来源:EventHandlerPneumaticCraft.java

示例7: init

import net.minecraftforge.fluids.Fluid; //导入依赖的package包/类
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);
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:17,代码来源:HeatExchangerManager.java

示例8: renderWorldBlock

import net.minecraftforge.fluids.Fluid; //导入依赖的package包/类
@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;
}
 
开发者ID:grand-mine-inc,项目名称:Steam-and-Steel,代码行数:22,代码来源:RenderGlassTank.java

示例9: drawFluid

import net.minecraftforge.fluids.Fluid; //导入依赖的package包/类
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);
}
 
开发者ID:LasmGratel,项目名称:FoodCraft-Reloaded,代码行数:24,代码来源:FluidStackRenderer.java

示例10: registerGeoBurnables

import net.minecraftforge.fluids.Fluid; //导入依赖的package包/类
@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));
        }
    });
}
 
开发者ID:canitzp,项目名称:Metalworks,代码行数:18,代码来源:Registry.java

示例11: setFluid

import net.minecraftforge.fluids.Fluid; //导入依赖的package包/类
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());
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:24,代码来源:FluidBucketWrapper.java

示例12: suckLiquid

import net.minecraftforge.fluids.Fluid; //导入依赖的package包/类
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;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:35,代码来源:TileEntityGasLift.java

示例13: validateFluids

import net.minecraftforge.fluids.Fluid; //导入依赖的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

示例14: BaseLiquid

import net.minecraftforge.fluids.Fluid; //导入依赖的package包/类
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;
}
 
开发者ID:trigg,项目名称:Firma,代码行数:21,代码来源:BaseLiquid.java

示例15: matchFluidStack

import net.minecraftforge.fluids.Fluid; //导入依赖的package包/类
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;
}
 
开发者ID:HellFirePvP,项目名称:ModularMachinery,代码行数:21,代码来源:HybridStackHelper.java


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