Search in sources :

Example 61 with PacketBuffer

use of net.minecraft.network.PacketBuffer in project MinecraftForge by MinecraftForge.

the class FMLHandshakeMessage method makeCustomChannelRegistration.

public static FMLProxyPacket makeCustomChannelRegistration(Set<String> channels) {
    String salutation = Joiner.on('\0').join(Iterables.concat(Arrays.asList("FML|HS", "FML", "FML|MP"), channels));
    FMLProxyPacket proxy = new FMLProxyPacket(new PacketBuffer(Unpooled.wrappedBuffer(salutation.getBytes(Charsets.UTF_8))), "REGISTER");
    return proxy;
}
Also used : FMLProxyPacket(net.minecraftforge.fml.common.network.internal.FMLProxyPacket) PacketBuffer(net.minecraft.network.PacketBuffer)

Example 62 with PacketBuffer

use of net.minecraft.network.PacketBuffer in project MinecraftForge by MinecraftForge.

the class ForgeNetworkTestMod method onPlayerLogin.

@SubscribeEvent
public void onPlayerLogin(PlayerLoggedInEvent e) {
    if (channel == null)
        return;
    PacketBuffer buffer = new PacketBuffer(Unpooled.buffer());
    buffer.writeByte(0);
    // disconnects vanilla clients in 1.11
    channel.sendTo(new FMLProxyPacket(buffer, MOD_ID), (EntityPlayerMP) e.player);
}
Also used : FMLProxyPacket(net.minecraftforge.fml.common.network.internal.FMLProxyPacket) PacketBuffer(net.minecraft.network.PacketBuffer) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 63 with PacketBuffer

use of net.minecraft.network.PacketBuffer in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class PilotControlsMessage method fromBytes.

@Override
public void fromBytes(ByteBuf buf) {
    PacketBuffer packetBuf = new PacketBuffer(buf);
    airshipUp = packetBuf.readBoolean();
    airshipDown = packetBuf.readBoolean();
    airshipForward = packetBuf.readBoolean();
    airshipBackward = packetBuf.readBoolean();
    airshipLeft = packetBuf.readBoolean();
    airshipRight = packetBuf.readBoolean();
    airshipSprinting = packetBuf.readBoolean();
    shipFor = packetBuf.readUuid();
}
Also used : PacketBuffer(net.minecraft.network.PacketBuffer)

Example 64 with PacketBuffer

use of net.minecraft.network.PacketBuffer in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class PilotControlsMessage method toBytes.

@Override
public void toBytes(ByteBuf buf) {
    PacketBuffer packetBuf = new PacketBuffer(buf);
    packetBuf.writeBoolean(airshipUp);
    packetBuf.writeBoolean(airshipDown);
    packetBuf.writeBoolean(airshipForward);
    packetBuf.writeBoolean(airshipBackward);
    packetBuf.writeBoolean(airshipLeft);
    packetBuf.writeBoolean(airshipRight);
    packetBuf.writeBoolean(airshipSprinting);
    packetBuf.writeUuid(shipFor);
}
Also used : PacketBuffer(net.minecraft.network.PacketBuffer)

Example 65 with PacketBuffer

use of net.minecraft.network.PacketBuffer in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class SetShipPilotMessage method toBytes.

@Override
public void toBytes(ByteBuf buf) {
    PacketBuffer packetBuffer = new PacketBuffer(buf);
    packetBuffer.writeUuid(entityUniqueID);
}
Also used : PacketBuffer(net.minecraft.network.PacketBuffer)

Aggregations

PacketBuffer (net.minecraft.network.PacketBuffer)105 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)20 IOException (java.io.IOException)14 FMLProxyPacket (net.minecraftforge.fml.common.network.internal.FMLProxyPacket)14 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