Java Code Examples for net.minecraftforge.fml.common.network.ByteBufUtils#writeTag()
The following examples show how to use
net.minecraftforge.fml.common.network.ByteBufUtils#writeTag() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PacketSyncContainerFluid.java From customstuff4 with GNU General Public License v3.0 | 5 votes |
@Override public void toBytes(ByteBuf buf) { buf.writeByte(windowId); buf.writeByte(tank); NBTTagCompound fluidNbt = fluid == null ? null : fluid.writeToNBT(new NBTTagCompound()); ByteBufUtils.writeTag(buf, fluidNbt); }
Example 2
Source File: MessagePlayerCivilizationSetInCiv.java From ToroQuest with GNU General Public License v3.0 | 5 votes |
@Override public void toBytes(ByteBuf buf) { if (province == null) { ByteBufUtils.writeTag(buf, new NBTTagCompound()); } else { ByteBufUtils.writeTag(buf, province.writeNBT()); } }
Example 3
Source File: MessageNBTUpdate.java From ExNihiloAdscensio with MIT License | 5 votes |
@Override public void toBytes(ByteBuf buf) { buf.writeInt(x); buf.writeInt(y); buf.writeInt(z); ByteBufUtils.writeTag(buf, tag); }
Example 4
Source File: PacketDescription.java From Signals with GNU General Public License v3.0 | 5 votes |
@Override public void toBytes(ByteBuf buf){ super.toBytes(buf); buf.writeByte(type.ordinal()); buf.writeInt(values.length); for(int i = 0; i < types.length; i++) { buf.writeByte(types[i]); PacketUpdateGui.writeField(buf, values[i], types[i]); } ByteBufUtils.writeTag(buf, extraData); }
Example 5
Source File: PacketUpdateGui.java From Signals with GNU General Public License v3.0 | 5 votes |
public static void writeField(ByteBuf buf, Object value, int type){ switch(type){ case 0: buf.writeInt((Integer)value); break; case 1: buf.writeFloat((Float)value); break; case 2: buf.writeDouble((Double)value); break; case 3: buf.writeBoolean((Boolean)value); break; case 4: ByteBufUtils.writeUTF8String(buf, (String)value); break; case 5: buf.writeByte((Byte)value); break; case 6: ByteBufUtils.writeItemStack(buf, (ItemStack)value); break; case 7: buf.writeBoolean(value != null); if(value != null) { FluidStack stack = (FluidStack)value; ByteBufUtils.writeUTF8String(buf, stack.getFluid().getName()); buf.writeInt(stack.amount); ByteBufUtils.writeTag(buf, stack.tag); } break; } }
Example 6
Source File: MerchantRecipes.java From HoloInventory with MIT License | 5 votes |
@Override public void toBytes(ByteBuf buf) { super.toBytes(buf); ByteBufUtils.writeUTF8String(buf, Strings.nullToEmpty(name)); ByteBufUtils.writeTag(buf, tag); }
Example 7
Source File: BlockStorage.java From CommunityMod with GNU Lesser General Public License v2.1 | 4 votes |
public void toBuf(ByteBuf buf) { buf.writeInt(Block.getStateId(blockstate)); buf.writeInt(light); ByteBufUtils.writeTag(buf, tileentity == null ? null : tileentity.serializeNBT()); }
Example 8
Source File: MessageProcessorUpdate.java From Minecoprocessors with GNU General Public License v3.0 | 4 votes |
@Override public void toBytes(ByteBuf buf) { ByteBufUtils.writeTag(buf, processorData); buf.writeLong(pos.toLong()); ByteBufUtils.writeUTF8String(buf, name); }
Example 9
Source File: SyncHudDataPacket.java From Cyberware with MIT License | 4 votes |
@Override public void toBytes(ByteBuf buf) { ByteBufUtils.writeTag(buf, comp); }
Example 10
Source File: CyberwareSyncPacket.java From Cyberware with MIT License | 4 votes |
@Override public void toBytes(ByteBuf buf) { buf.writeInt(entityId); ByteBufUtils.writeTag(buf, data); }
Example 11
Source File: MessagePipeContentUpdate.java From Logistics-Pipes-2 with MIT License | 4 votes |
@Override public void toBytes(ByteBuf buf) { ByteBufUtils.writeTag(buf, tag); }
Example 12
Source File: MessageBase.java From Production-Line with MIT License | 4 votes |
/** * Deconstruct your message into the supplied byte buffer */ @Override public final void toBytes(ByteBuf buf) { ByteBufUtils.writeTag(buf, this.nbt); }