Beispiel #1
0
        public bool IsFlat;                          //*

        public override void Read(byte[] array)
        {
            McInt.TryParse(ref array, out EntityId);
            McBoolean.TryParse(ref array, out IsHardcore);
            if (McUnsignedByte.TryParse(ref array, out var gamemode))
            {
                Gamemode = (Gamemodes)gamemode;
            }
            if (McByte.TryParse(ref array, out var previousGamemode))
            {
                PreviousGamemode = (Gamemodes)previousGamemode;
            }
            McVarint.TryParse(ref array, out WorldCount);
            McStringArray.TryParse(WorldCount, ref array, out WorldNames);
            McNbtCompoundTag.TryParse(ref array, out DimensionCodec);
            McNbtCompoundTag.TryParse(ref array, out Dimension);
            McString.TryParse(ref array, out WorldName);
            McLong.TryParse(ref array, out HashedSeed);
            McVarint.TryParse(ref array, out MaxPlayers);
            McVarint.TryParse(ref array, out ViewDistance);
            McBoolean.TryParse(ref array, out ReducedDebugInfo);
            McBoolean.TryParse(ref array, out EnableRespawnScreen);
            McBoolean.TryParse(ref array, out IsDebug);
            McBoolean.TryParse(ref array, out IsFlat);
        }
Beispiel #2
0
 public override void Read(byte[] array)
 {
     _ = McInt.TryParse(ref array, out EntityID);
     if (McByte.TryParse(ref array, out var entityStatus))
     {
         EntityStatus = (StatusTable)entityStatus;
     }
 }
Beispiel #3
0
 public override void Read(byte[] array)
 {
     McInt.TryParse(ref array, out EffectID);
     Positions = new Position();
     Positions.Read(ref array);
     McInt.TryParse(ref array, out Data);
     McBoolean.TryParse(ref array, out DisableRelativeVolume);
 }
Beispiel #4
0
        public override void Read(byte[] array)
        {
            McVarint.TryParse(ref array, out EntityID);
            McInt.TryParse(ref array, out NumberOfProperties);

            Property = new EntityProperty[NumberOfProperties];
            for (int i = 0; i < NumberOfProperties; i++)
            {
                Property[i] = new EntityProperty();
                Property[i].Read(ref array);
            }
        }
Beispiel #5
0
 public override void Read(byte[] array)
 {
     McFloat.TryParse(ref array, out X);
     McFloat.TryParse(ref array, out Y);
     McFloat.TryParse(ref array, out Z);
     McFloat.TryParse(ref array, out Strength);
     McInt.TryParse(ref array, out RecordCount);
     McByteArray.TryParse(ref array, out Records);
     McFloat.TryParse(ref array, out PlayerMotionX);
     McFloat.TryParse(ref array, out PlayerMotionY);
     McFloat.TryParse(ref array, out PlayerMotionZ);
 }
Beispiel #6
0
        public override void Read(byte[] array)
        {
            McInt.TryParse(ref array, out ChunkX);
            McInt.TryParse(ref array, out ChunkZ);
            McVarint.TryParse(ref array, out RecordCount);

            Records = new Record[RecordCount];
            for (int i = 0; i < RecordCount; i++)
            {
                Records[i] = new Record();
                Records[i].Read(ref array);
            }
        }
Beispiel #7
0
        public override byte[] Write()
        {
            List <byte> bytes = new List <byte>();

            bytes.AddRange(McVarint.ToBytes(EntityId));
            bytes.AddRange(McUUID.ToBytes(UUID));
            bytes.AddRange(McVarint.ToBytes(Type));
            bytes.AddRange(McDouble.ToBytes(X));
            bytes.AddRange(McDouble.ToBytes(Y));
            bytes.AddRange(McDouble.ToBytes(Z));
            bytes.AddRange(McUnsignedByte.ToBytes(Pitch));
            bytes.AddRange(McUnsignedByte.ToBytes(Yaw));
            bytes.AddRange(McInt.ToBytes(Data));
            bytes.AddRange(McShort.ToBytes(VelocityX));
            bytes.AddRange(McShort.ToBytes(VelocityY));
            bytes.AddRange(McShort.ToBytes(VelocityZ));
            return(bytes.ToArray());
        }
Beispiel #8
0
        public override void Read(byte[] array)
        {
            McInt.TryParse(ref array, out ChunkX);             // int
            McInt.TryParse(ref array, out ChunkZ);             // int
            McBoolean.TryParse(ref array, out Fullchunk);      // bool
            McVarint.TryParse(ref array, out PrimaryBitMask);  // var int

            McNbtCompoundTag.TryParse(ref array, out Heightmaps);

            if (Fullchunk)
            {
                McVarint.TryParse(ref array, out Biomeslength);
                Biomes = new int[Biomeslength];
                for (int i = 0; i < Biomeslength; i++)
                {
                    McVarint.TryParse(ref array, out Biomes[i]);
                }
            }

            // chunk data
            McVarint.TryParse(ref array, out Size);             // size varint
            McByteArray.TryParse(Size, ref array, out Data);    // Byte array

            // BlockEntities
            McVarint.TryParse(ref array, out NumberOfBlockEntities);

            BlockEntities = new NbtCompoundTag[NumberOfBlockEntities];

            var    read1   = new NbtParser();
            Stream stream1 = new MemoryStream(array);

            for (int i = 0; i < NumberOfBlockEntities; i++)
            {
                BlockEntities[i] = read1.ParseNbtStream(stream1);
            }
        }
Beispiel #9
0
 public override void Read(byte[] array)
 {
     McInt.TryParse(ref array, out ChunkX);
     McInt.TryParse(ref array, out ChunkZ);
 }
Beispiel #10
0
 public override void Read(byte[] array)
 {
     McInt.TryParse(ref array, out AttachedEntityID);
     McInt.TryParse(ref array, out HoldingEntityID);
 }