Java Code Examples for net.minecraftforge.fml.common.network.ByteBufUtils#writeUTF8String()
The following examples show how to use
net.minecraftforge.fml.common.network.ByteBufUtils#writeUTF8String() .
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: MessageSendServerTab.java From IGW-mod with GNU General Public License v2.0 | 6 votes |
@Override public void toBytes(ByteBuf buf){ File[] files = serverFolder.listFiles(); buf.writeInt(files.length); for(File file : files) { try { ByteBufUtils.writeUTF8String(buf, file.getName()); FileInputStream stream = new FileInputStream(file); byte[] byteArray = IOUtils.toByteArray(stream); buf.writeInt(byteArray.length); buf.writeBytes(byteArray); stream.close(); } catch(Exception e) { e.printStackTrace(); } } }
Example 2
Source File: ObservationFromGridImplementation.java From malmo with MIT License | 6 votes |
@Override void persistState(ByteBuf buf) { buf.writeInt(this.environs.size()); for (SimpleGridDef sgd : this.environs) { buf.writeInt(sgd.xMin); buf.writeInt(sgd.yMin); buf.writeInt(sgd.zMin); buf.writeInt(sgd.xMax); buf.writeInt(sgd.yMax); buf.writeInt(sgd.zMax); ByteBufUtils.writeUTF8String(buf, sgd.name); buf.writeBoolean(sgd.absoluteCoords); } }
Example 3
Source File: InventoryCommandsImplementation.java From malmo with MIT License | 6 votes |
@Override public void toBytes(ByteBuf buf) { ByteBufUtils.writeUTF8String(buf, this.invA); buf.writeInt(this.slotA); ByteBufUtils.writeUTF8String(buf, this.invB); buf.writeInt(this.slotB); buf.writeBoolean(this.combine); buf.writeBoolean(this.containerPos != null); if (this.containerPos != null) { buf.writeInt(this.containerPos.getX()); buf.writeInt(this.containerPos.getY()); buf.writeInt(this.containerPos.getZ()); } }
Example 4
Source File: MessageBarrelModeUpdate.java From ExNihiloAdscensio with MIT License | 5 votes |
@Override public void toBytes(ByteBuf buf) { buf.writeInt(x); buf.writeInt(y); buf.writeInt(z); ByteBufUtils.writeUTF8String(buf, modeName); }
Example 5
Source File: PlayerSkillData.java From TFC2 with GNU General Public License v3.0 | 5 votes |
public void toOutBuffer(ByteBuf buffer) { Object[] keys = skillsMap.keySet().toArray(); buffer.writeInt(keys.length); for(Object o : keys) { Skill k = (Skill)o; float f = skillsMap.get(k); ByteBufUtils.writeUTF8String(buffer, k.skillName); buffer.writeFloat(f); } }
Example 6
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 7
Source File: PacketUpdateMessage.java From Signals with GNU General Public License v3.0 | 5 votes |
@Override public void toBytes(ByteBuf buf){ super.toBytes(buf); buf.writeInt(entityId); ByteBufUtils.writeUTF8String(buf, message); buf.writeInt(args.length); for(String arg : args) ByteBufUtils.writeUTF8String(buf, arg); }
Example 8
Source File: MCNetworkRail.java From Signals with GNU General Public License v3.0 | 5 votes |
@Override public void writeToBuf(ByteBuf b){ getPos().writeToBuf(b); b.writeByte(curDir.ordinal()); ByteBufUtils.writeUTF8String(b, railType == null ? NORMAL_RAIL_STRING : railType); if(railType != null) { b.writeShort(EnumSetUtils.toShort(validRailDirs)); } }
Example 9
Source File: MessageFluidUpdate.java From ExNihiloAdscensio with MIT License | 5 votes |
@Override public void toBytes(ByteBuf buf) { buf.writeInt(x); buf.writeInt(y); buf.writeInt(z); buf.writeInt(fillAmount); ByteBufUtils.writeUTF8String(buf, fluidName); }
Example 10
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 11
Source File: PlainInventory.java From HoloInventory with MIT License | 5 votes |
@Override public void toBytes(ByteBuf buf) { super.toBytes(buf); ByteBufUtils.writeUTF8String(buf, Strings.nullToEmpty(name)); buf.writeInt(stacks.size()); for (ItemStack stack : stacks) ByteBufUtils.writeItemStack(buf, stack); }
Example 12
Source File: NearbyCraftCommandsImplementation.java From malmo with MIT License | 4 votes |
@Override public void toBytes(ByteBuf buf) { ByteBufUtils.writeUTF8String(buf, this.parameters); }
Example 13
Source File: PacketKeyMessage.java From Sakura_mod with MIT License | 4 votes |
@Override public void toBytes(ByteBuf buf) { ByteBufUtils.writeUTF8String(buf,sender); }
Example 14
Source File: EntityFluidCow.java From Moo-Fluids with GNU General Public License v3.0 | 4 votes |
@Override public void writeSpawnData(final ByteBuf buffer) { ByteBufUtils.writeUTF8String(buffer, entityFluid.getName()); ByteBufUtils.writeVarInt(buffer, nextUseCooldown, 4); }
Example 15
Source File: PacketUpdateTextfieldEntity.java From Signals with GNU General Public License v3.0 | 4 votes |
@Override public void toBytes(ByteBuf buffer){ buffer.writeInt(textFieldID); buffer.writeInt(entityId); ByteBufUtils.writeUTF8String(buffer, text); }
Example 16
Source File: MessageSendString.java From enderutilities with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void toBytes(ByteBuf buf) { buf.writeByte(this.type.ordinal()); ByteBufUtils.writeUTF8String(buf, this.text); }
Example 17
Source File: MessageSetPlayerReputation.java From ToroQuest with GNU General Public License v3.0 | 4 votes |
@Override public void toBytes(ByteBuf buf) { buf.writeInt(amount); ByteBufUtils.writeUTF8String(buf, s(civ)); }
Example 18
Source File: PacketUpdateTicket.java From Signals with GNU General Public License v3.0 | 4 votes |
@Override public void toBytes(ByteBuf buffer){ ByteBufUtils.writeUTF8String(buffer, destinations); ByteBufUtils.writeUTF8String(buffer, itemName); }
Example 19
Source File: MessageSetQuestInfo.java From ToroQuest with GNU General Public License v3.0 | 4 votes |
@Override public void toBytes(ByteBuf buf) { ByteBufUtils.writeUTF8String(buf, questMessageJson); }
Example 20
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); }