本文整理汇总了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;
}
示例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);
}
}
示例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);
}
示例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");
}
}