package eiteam.esteemedinnovation.hammer; import io.netty.buffer.ByteBuf; import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.common.network.ByteBufUtils; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; public class ItemNamePacket implements IMessage { public int x; public int y; public int z; public String name; public ItemNamePacket() {} public ItemNamePacket(BlockPos pos, String name) { this.x = pos.getX(); this.y = pos.getY(); this.z = pos.getZ(); this.name = name; } @Override public void fromBytes(ByteBuf buf) { this.x = buf.readInt(); this.y = buf.readInt(); this.z = buf.readInt(); this.name = ByteBufUtils.readUTF8String(buf); } @Override public void toBytes(ByteBuf buf) { buf.writeInt(this.x); buf.writeInt(this.y); buf.writeInt(this.z); ByteBufUtils.writeUTF8String(buf, this.name); } }