Search in sources :

Example 1 with PhysWrapperPositionMessage

use of ValkyrienWarfareBase.Network.PhysWrapperPositionMessage in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class PhysicsObject method readSpawnData.

public void readSpawnData(ByteBuf additionalData) {
    PacketBuffer modifiedBuffer = new PacketBuffer(additionalData);
    ownedChunks = new ChunkSet(modifiedBuffer.readInt(), modifiedBuffer.readInt(), modifiedBuffer.readInt());
    wrapper.posX = modifiedBuffer.readDouble();
    wrapper.posY = modifiedBuffer.readDouble();
    wrapper.posZ = modifiedBuffer.readDouble();
    wrapper.pitch = modifiedBuffer.readDouble();
    wrapper.yaw = modifiedBuffer.readDouble();
    wrapper.roll = modifiedBuffer.readDouble();
    wrapper.prevPitch = wrapper.pitch;
    wrapper.prevYaw = wrapper.yaw;
    wrapper.prevRoll = wrapper.roll;
    wrapper.lastTickPosX = wrapper.posX;
    wrapper.lastTickPosY = wrapper.posY;
    wrapper.lastTickPosZ = wrapper.posZ;
    centerCoord = new Vector(modifiedBuffer);
    for (boolean[] array : ownedChunks.chunkOccupiedInLocal) {
        for (int i = 0; i < array.length; i++) {
            array[i] = modifiedBuffer.readBoolean();
        }
    }
    loadClaimedChunks();
    renderer.updateOffsetPos(refrenceBlockPos);
    coordTransform.stack.pushMessage(new PhysWrapperPositionMessage(this));
    try {
        NBTTagCompound entityFixedPositionNBT = modifiedBuffer.readNBTTagCompoundFromBuffer();
        entityLocalPositions = NBTUtils.readEntityPositionMap("entityFixedPosMap", entityFixedPositionNBT);
    // if(worldObj.isRemote){
    // System.out.println(entityLocalPositions.containsKey(Minecraft.getMinecraft().thePlayer.getPersistentID().hashCode()));
    // System.out.println(Minecraft.getMinecraft().thePlayer.getPersistentID().hashCode());
    // }
    } catch (IOException e) {
        System.err.println("Couldn't load the entityFixedPosNBT; this is really bad.");
        e.printStackTrace();
    }
    isNameCustom = modifiedBuffer.readBoolean();
    shipType = modifiedBuffer.readEnumValue(ShipType.class);
}
Also used : PhysWrapperPositionMessage(ValkyrienWarfareBase.Network.PhysWrapperPositionMessage) ChunkSet(ValkyrienWarfareBase.ChunkManagement.ChunkSet) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) IOException(java.io.IOException) Vector(ValkyrienWarfareBase.API.Vector) PacketBuffer(net.minecraft.network.PacketBuffer)

Aggregations

Vector (ValkyrienWarfareBase.API.Vector)1 ChunkSet (ValkyrienWarfareBase.ChunkManagement.ChunkSet)1 PhysWrapperPositionMessage (ValkyrienWarfareBase.Network.PhysWrapperPositionMessage)1 IOException (java.io.IOException)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 PacketBuffer (net.minecraft.network.PacketBuffer)1