Search in sources :

Example 26 with PacketBuffer

use of net.minecraft.network.PacketBuffer in project Wurst-MC-1.12 by Wurst-Imperium.

the class LogSpammerMod method onEnable.

@Override
public void onEnable() {
    random = new Random();
    payload = new PacketBuffer(Unpooled.buffer());
    byte[] rawPayload = new byte[random.nextInt(128)];
    random.nextBytes(rawPayload);
    payload.writeBytes(rawPayload);
    wurst.events.add(UpdateListener.class, this);
}
Also used : Random(java.util.Random) PacketBuffer(net.minecraft.network.PacketBuffer)

Example 27 with PacketBuffer

use of net.minecraft.network.PacketBuffer in project RFTools by McJty.

the class PacketModuleUpdate method fromBytes.

@Override
public void fromBytes(ByteBuf buf) {
    pos = NetworkTools.readPos(buf);
    slotIndex = buf.readInt();
    PacketBuffer buffer = new PacketBuffer(buf);
    try {
        tagCompound = buffer.readCompoundTag();
    } catch (IOException e) {
        Logging.logError("Error updating module", e);
    }
}
Also used : IOException(java.io.IOException) PacketBuffer(net.minecraft.network.PacketBuffer)

Example 28 with PacketBuffer

use of net.minecraft.network.PacketBuffer in project RFTools by McJty.

the class PacketModuleUpdate method toBytes.

@Override
public void toBytes(ByteBuf buf) {
    NetworkTools.writePos(buf, pos);
    buf.writeInt(slotIndex);
    PacketBuffer buffer = new PacketBuffer(buf);
    buffer.writeCompoundTag(tagCompound);
}
Also used : PacketBuffer(net.minecraft.network.PacketBuffer)

Example 29 with PacketBuffer

use of net.minecraft.network.PacketBuffer in project BloodMagic by WayofTime.

the class ItemRouterButtonPacketProcessor method fromBytes.

@Override
public void fromBytes(ByteBuf buffer) {
    PacketBuffer buff = new PacketBuffer(buffer);
    dimension = buff.readInt();
    pos = buff.readBlockPos();
    buttonPress = buff.readInt();
}
Also used : PacketBuffer(net.minecraft.network.PacketBuffer)

Example 30 with PacketBuffer

use of net.minecraft.network.PacketBuffer in project BloodMagic by WayofTime.

the class PlayerFallDistancePacketProcessor method toBytes.

@Override
public void toBytes(ByteBuf buffer) {
    PacketBuffer buff = new PacketBuffer(buffer);
    buff.writeFloat(fallDistance);
}
Also used : PacketBuffer(net.minecraft.network.PacketBuffer)

Aggregations

PacketBuffer (net.minecraft.network.PacketBuffer)103 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)18 FMLProxyPacket (net.minecraftforge.fml.common.network.internal.FMLProxyPacket)14 IOException (java.io.IOException)13 ByteBuf (io.netty.buffer.ByteBuf)11 SPacketCustomPayload (net.minecraft.network.play.server.SPacketCustomPayload)7 BlockPos (net.minecraft.util.math.BlockPos)7 HashMap (java.util.HashMap)4 DimensionInformation (mcjty.rftoolsdim.dimensions.DimensionInformation)4 DimensionDescriptor (mcjty.rftoolsdim.dimensions.description.DimensionDescriptor)4 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)4 ArrayList (java.util.ArrayList)3 Map (java.util.Map)3 NetHandlerPlayServer (net.minecraft.network.NetHandlerPlayServer)3 Test (org.junit.Test)3 PacketBufferBC (buildcraft.lib.net.PacketBufferBC)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)2 PacketCustomTileData (gregtech.api.net.PacketCustomTileData)2 PacketUIWidgetUpdate (gregtech.api.net.PacketUIWidgetUpdate)2 AbstractData (hellfirepvp.fracture.common.data.AbstractData)2