本文整理匯總了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");
}
}