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


Java FluidTankInfo类代码示例

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


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

示例1: renderLiquid

import net.minecraftforge.fluids.FluidTankInfo; //导入依赖的package包/类
public void renderLiquid(FluidTankInfo info, RenderInfo renderInfo, World world) {
    if (info.fluid.getFluid().getBlock() != null) {
        renderInfo.baseBlock = info.fluid.getFluid().getBlock();
    } else {
        renderInfo.baseBlock = Blocks.WATER;
    }
    renderInfo.texture = info.fluid.getFluid().getStill(info.fluid); //TODO 1.8 still or flowing?
    FMLClientHandler.instance().getClient().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    // Tessellator.instance.setColorOpaque_I();
    int color = info.fluid.getFluid().getColor(info.fluid);
    int red = color >> 16 & 255;
    int green = color >> 8 & 255;
    int blue = color & 255;
    GL11.glColor4ub((byte) red, (byte) green, (byte) blue, (byte) 255);
    RenderUtils.INSTANCE.renderBlock(renderInfo, world, 0, 0, 0, false, true);
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:17,代码来源:RenderUtils.java

示例2: addData

import net.minecraftforge.fluids.FluidTankInfo; //导入依赖的package包/类
@Override
public void addData(final Object tile, final List<String> data, final ForgeDirection side, final EntityPlayer player) {
    final FluidTankInfo[] tanks = ((IFluidHandler)tile).getTankInfo(side);
    if (tanks != null) {
        if (tanks.length == 1) {
            if (tanks[0].fluid != null && tanks[0].fluid.amount > 0) {
                data.add("Fluid Tank: " + tanks[0].fluid.getFluid().getLocalizedName(tanks[0].fluid) + " - " + tanks[0].fluid.amount + " / " + tanks[0].capacity);
            }
            else {
                data.add("Fluid Tank: Empty - 0 / " + tanks[0].capacity);
            }
        }
        else {
            for (int i = 0; i < tanks.length; ++i) {
                if (tanks[i].fluid != null && tanks[i].fluid.amount > 0) {
                    data.add("Fluid Tank " + i + ": " + tanks[i].fluid.getFluid().getLocalizedName(tanks[i].fluid) + " - " + tanks[i].fluid.amount + " / " + tanks[i].capacity);
                }
                else {
                    data.add("Fluid Tank " + i + ": Empty - 0 / " + tanks[i].capacity);
                }
            }
        }
    }
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:25,代码来源:ScannerRegistry.java

示例3: getComparatorInputOverride

import net.minecraftforge.fluids.FluidTankInfo; //导入依赖的package包/类
public int getComparatorInputOverride(final World world, final int x, final int y, final int z, final int side) {
    if (!(world.getTileEntity(x, y, z) instanceof TileEntityDrum)) {
        return 0;
    }
    final TileEntityDrum drum = (TileEntityDrum)world.getTileEntity(x, y, z);
    final FluidTankInfo tank = drum.getTankInfo(ForgeDirection.UP)[0];
    if (tank == null || tank.fluid == null || tank.fluid.amount == 0) {
        return 0;
    }
    double t = tank.fluid.amount * 14.0 / tank.capacity;
    if (t < 0.0) {
        t = 0.0;
    }
    if (t > 15.0) {
        t = 14.0;
    }
    return (int)Math.floor(t) + 1;
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:19,代码来源:BlockDrum.java

示例4: isValidTileEntity

import net.minecraftforge.fluids.FluidTankInfo; //导入依赖的package包/类
public static boolean isValidTileEntity(final TileEntity inv, final int side) {
    if (inv == null) {
        return false;
    }
    final ForgeDirection forgeSide = ForgeDirection.getOrientation(side);
    final String classname = inv.getClass().toString();
    if (classname.contains("thermalexpansion") && classname.contains("conduit")) {
        return false;
    }
    if (inv instanceof IFluidHandler) {
        final FluidTankInfo[] t = ((IFluidHandler)inv).getTankInfo(forgeSide);
        if (t != null && t.length != 0) {
            return true;
        }
    }
    if (inv instanceof IInventory && ((IInventory)inv).getSizeInventory() > 0) {
        if (!(inv instanceof ISidedInventory)) {
            return true;
        }
        final int[] t2 = ((ISidedInventory)inv).getAccessibleSlotsFromSide(side);
        if (t2 != null && t2.length != 0) {
            return true;
        }
    }
    return isRFEnergy(inv, forgeSide);
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:27,代码来源:TNHelper.java

示例5: isValidAcceptorOnSide

import net.minecraftforge.fluids.FluidTankInfo; //导入依赖的package包/类
public static boolean isValidAcceptorOnSide(TileEntity tile, ForgeDirection side)
{
	if(tile instanceof ITransmitterTile || !(tile instanceof IFluidHandler))
		return false;

	IFluidHandler container = (IFluidHandler)tile;
	FluidTankInfo[] infoArray = container.getTankInfo(side.getOpposite());

	if(container.canDrain(side.getOpposite(), FluidRegistry.WATER)
		|| container.canFill(side.getOpposite(), FluidRegistry.WATER)) //I hesitate to pass null to these.
	{
		return true;
	}
	else if(infoArray != null && infoArray.length > 0)
	{
		for(FluidTankInfo info : infoArray)
		{
			if(info != null)
			{
				return true;
			}
		}
	}
	return false;
}
 
开发者ID:Microsoft,项目名称:vsminecraft,代码行数:26,代码来源:PipeUtils.java

示例6: init

import net.minecraftforge.fluids.FluidTankInfo; //导入依赖的package包/类
@EventHandler
public void init(FMLInitializationEvent event) {
	PacketHandler.init();
	Recipes.init();

	proxy.registerTileEntities();
	proxy.registerRenderers();

	NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());

	FMLCommonHandler.instance().bus().register(new TickHandler());

	LuaType.registerTypeConverter(new ConverterFluidTankInfo());
	LuaType.registerTypeConverter(new ConverterForgeDirection());
	LuaType.registerTypeConverter(new ConverterAdvancedItemStack());

	LuaType.registerClassToNameMapping(FluidTankInfo.class, "fluid_tank");
	LuaType.registerClassToNameMapping(ForgeDirection.class, "direction");
	LuaType.registerClassToNameMapping(AdvancedItemStack.class, "item_with_nbt");

}
 
开发者ID:thraaawn,项目名称:CCFactoryManager,代码行数:22,代码来源:CCFactoryManager.java

示例7: updateLiquid

import net.minecraftforge.fluids.FluidTankInfo; //导入依赖的package包/类
public CardState updateLiquid(World world, ICardWrapper card, int range) {
	ChunkCoordinates target = card.getTarget();
	if(target == null) return CardState.NO_TARGET;
	FluidTankInfo storage = LiquidStorageHelper.getStorageAt(world, target.posX, target.posY, target.posZ);
	if (storage != null) {
		int capacity = storage.capacity;
		int amount = 0;
		int liquidId = 0;
		NBTTagCompound liquidTag = null;
		if (storage.fluid != null) {
			amount = storage.fluid.amount;
			if (storage.fluid.getFluidID() != 0 && amount > 0) {
				liquidId = storage.fluid.getFluidID();
				liquidTag = storage.fluid.tag;
			}
		}
		card.setInt("capacity", capacity);
		card.setInt("amount", amount);
		card.setInt("liquidId", liquidId);
		card.setTag("liquidTag", liquidTag);
		card.setDouble("range_trigger_amount", (double)amount);
		return CardState.OK;
	} else {
		return CardState.NO_TARGET;
	}
}
 
开发者ID:xbony2,项目名称:Nuclear-Control,代码行数:27,代码来源:ItemCardMultipleSensorLocation.java

示例8: getTankInfo

import net.minecraftforge.fluids.FluidTankInfo; //导入依赖的package包/类
@Override
public FluidTankInfo[] getTankInfo(ForgeDirection from)
{
	if (!this.isInProgress() || copyStack == null)
		return null;
	
	FluidTankInfo[] ret = new FluidTankInfo[1];
	for (Type t : Type.values())
	{
		int num = copyStack.stackTagCompound.getInteger(t.name());
		if (num > 0)
		{
			ArrayUtils.add(ret, new FluidTankInfo(new FluidStack(MCFluids.fluidsEnumList.get(t), 0), num));
		}
	}

	return ret;
}
 
开发者ID:MikeLydeamore,项目名称:MatterCrystals,代码行数:19,代码来源:TileAtomicAssembler.java

示例9: renderStatic

import net.minecraftforge.fluids.FluidTankInfo; //导入依赖的package包/类
@Override
public void renderStatic(float size, TileEntity te){
    Shape2.render(size);
    Shape3b.render(size);
    Shape1.render(size);
    Shape3.render(size);
    Shape4b.render(size);
    Shape4.render(size);

    if(te != null) {
        TileEntityPlasticMixer mixer = (TileEntityPlasticMixer)te;
        FluidTankInfo info = mixer.getTankInfo(null)[0];
        if(info.fluid != null && info.fluid.amount > 10) {
            float percentageFull = (float)info.fluid.amount / info.capacity;
            RenderInfo renderInfo = new RenderInfo(-6 / 16F + 0.01F, 22 / 16F - percentageFull * 13.999F / 16F, -6 / 16F + 0.01F, 6 / 16F - 0.01F, 22 / 16F, 6 / 16F - 0.01F);
            RenderUtils.INSTANCE.renderLiquid(info, renderInfo, mixer.getWorldObj());
        }
    }
}
 
开发者ID:MineMaarten,项目名称:PneumaticCraft,代码行数:20,代码来源:ModelPlasticMixer.java

示例10: renderLiquid

import net.minecraftforge.fluids.FluidTankInfo; //导入依赖的package包/类
public void renderLiquid(FluidTankInfo info, RenderInfo renderInfo, World worldObj){
    if(info.fluid.getFluid().getBlock() != null) {
        renderInfo.baseBlock = info.fluid.getFluid().getBlock();
    } else {
        renderInfo.baseBlock = Blocks.water;
    }
    renderInfo.texture = info.fluid.getFluid().getIcon(info.fluid);
    FMLClientHandler.instance().getClient().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
    // Tessellator.instance.setColorOpaque_I();
    int color = info.fluid.getFluid().getColor(info.fluid);
    int red = color >> 16 & 255;
    int green = color >> 8 & 255;
    int blue = color & 255;
    GL11.glColor4ub((byte)red, (byte)green, (byte)blue, (byte)255);
    RenderUtils.INSTANCE.renderBlock(renderInfo, worldObj, 0, 0, 0, false, true);
}
 
开发者ID:MineMaarten,项目名称:PneumaticCraft,代码行数:17,代码来源:RenderUtils.java

示例11: convert

import net.minecraftforge.fluids.FluidTankInfo; //导入依赖的package包/类
public static FluidTankProperties[] convert(FluidTankInfo[] fluidTankInfos)
{
    FluidTankProperties[] properties = new FluidTankProperties[fluidTankInfos.length];
    for (int i = 0; i < fluidTankInfos.length; i++)
    {
        FluidTankInfo info = fluidTankInfos[i];
        properties[i] = new FluidTankProperties(info.fluid, info.capacity);
    }
    return properties;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:11,代码来源:FluidTankProperties.java

示例12: WidgetTank

import net.minecraftforge.fluids.FluidTankInfo; //导入依赖的package包/类
public WidgetTank(final FluidTankInfo tankInfo, final int x, final int y, final int shape) {
    this.curFluid = null;
    this.curCapacity = 0;
    this.tankInfo = tankInfo;
    this.shape = shape;
    this.x = x;
    this.y = y;
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:9,代码来源:WidgetTank.java

示例13: DynamicContainerGenerator

import net.minecraftforge.fluids.FluidTankInfo; //导入依赖的package包/类
public DynamicContainerGenerator(final IInventory player, final TileEntityGenerator gen) {
    this.genFurnace = null;
    this.gen = gen;
    if (this.gen instanceof TileEntityGeneratorFurnace) {
        this.genFurnace = (TileEntityGeneratorFurnace)this.gen;
    }
    this.widgets.add(new WidgetText(5, 5, BlockGenerator.names[gen.getBlockMetadata()] + " Generator", 162));
    int x = 5;
    final int y = 19;
    if (gen instanceof IInventory) {
        final IInventory inv = (IInventory)gen;
        for (int i = 0; i < inv.getSizeInventory(); ++i) {
            final IWidget widg = new WidgetSlot(inv, i, x, y);
            this.widgets.add(widg);
            x += widg.getW() + 5;
        }
    }
    if (gen instanceof IFluidHandler) {
        final FluidTankInfo[] arr$;
        final FluidTankInfo[] tanks = arr$ = gen.getTankInfo(null);
        for (final FluidTankInfo tank : arr$) {
            final IWidget widg2 = new WidgetTank(tank, x, y, 2);
            this.widgets.add(widg2);
            x += widg2.getW() + 5;
        }
    }
    final IWidget w = new WidgetTextCooldown(gen, x, y, 120);
    this.widgets.add(w);
    x += w.getW() + 5;
    this.widgets.add(new WidgetEnergy(gen, ForgeDirection.UP, x, y));
    this.cropAndAddPlayerSlots(player);
    this.validate();
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:34,代码来源:DynamicContainerGenerator.java

示例14: getTankInfo

import net.minecraftforge.fluids.FluidTankInfo; //导入依赖的package包/类
public FluidTankInfo[] getTankInfo(final ForgeDirection from) {
    final FluidTankInfo[] info = new FluidTankInfo[this.getTanks().length];
    for (int i = 0; i < this.getTanks().length; ++i) {
        info[i] = this.getTanks()[i].getInfo();
    }
    return info;
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:8,代码来源:TileEntityGenerator.java

示例15: getTankInfo

import net.minecraftforge.fluids.FluidTankInfo; //导入依赖的package包/类
@Override
default FluidTankInfo[] getTankInfo(EnumFacing from)
{
    if (hasOriginTE())
    {
        return getOriginTE().getStructureTankInfo(from, getLocal());
    }

    return emptyFluidTankInfo;
}
 
开发者ID:FoudroyantFactotum,项目名称:Structure,代码行数:11,代码来源:IStructureShapeFluidHandler.java


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