當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。