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


Java FluidStack.writeToNBT方法代码示例

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


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

示例1: getTankStackFromTile

import net.minecraftforge.fluids.FluidStack; //导入方法依赖的package包/类
public static ItemStack getTankStackFromTile(TileGlassFluidTank tank, boolean keepFluid) {
	
	ItemStack stack = new ItemStack(GrandFluidTank.glassfluidtank);
	stack.setTagCompound(new NBTTagCompound());
	FluidStack fluid = tank.tank.getFluid();
	if (fluid != null && keepFluid) {
		NBTTagCompound tagFluid = new NBTTagCompound();
		fluid.writeToNBT(tagFluid);
		stack.getTagCompound().setTag("Fluid", tagFluid);
		
	}

	return stack;
}
 
开发者ID:grand-mine-inc,项目名称:Steam-and-Steel,代码行数:15,代码来源:Utils.java

示例2: writeFluidStack

import net.minecraftforge.fluids.FluidStack; //导入方法依赖的package包/类
public static void writeFluidStack(ByteBuf dataOut, FluidStack fluidStack) {
    PacketBuffer buf = new PacketBuffer(dataOut);
    NBTTagCompound nbt = new NBTTagCompound();
    fluidStack.writeToNBT(nbt);
    try {
        PacketBufferTools.writeCompoundTag(buf, nbt);
    } catch (Exception e) {
        InteractionWheel.logger.log(Level.ERROR, "Error writing fluid stack", e);
    }
}
 
开发者ID:McJty,项目名称:interactionwheel,代码行数:11,代码来源:NetworkTools.java

示例3: setFluid

import net.minecraftforge.fluids.FluidStack; //导入方法依赖的package包/类
protected void setFluid(FluidStack fluid)
{
    if (!container.hasTagCompound())
    {
        container.setTagCompound(new NBTTagCompound());
    }

    NBTTagCompound fluidTag = new NBTTagCompound();
    fluid.writeToNBT(fluidTag);
    container.getTagCompound().setTag(FLUID_NBT_KEY, fluidTag);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:12,代码来源:FluidHandlerItemStackSimple.java

示例4: setFluidStack

import net.minecraftforge.fluids.FluidStack; //导入方法依赖的package包/类
public void setFluidStack(FluidStack fs)
{
	if (fs != null)
	{
		NBTTagCompound tag = new NBTTagCompound();
		tag = fs.writeToNBT(tag);
		this.getContainer().getTagCompound().setTag("exp.wateringCanFluidStackTag", tag);
	}
	else
	{
		this.getContainer().getTagCompound().removeTag("exp.wateringCanFluidStackTag");
	}
}
 
开发者ID:V0idWa1k3r,项目名称:ExPetrum,代码行数:14,代码来源:WateringCanCapability.java


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