public void Read(MinecraftStream ms) { var blockCount = ms.ReadShort(); var bitsPerBlock = (byte)ms.ReadByte(); int palleteLength = 0;// = ms.ReadVarInt(); if (bitsPerBlock <= 4) { bitsPerBlock = 4; } if (bitsPerBlock <= 8) { _bits = bitsPerBlock; palleteLength = ms.ReadVarInt(); Pallette = new IntIdentityHashBiMap <BlockState>(palleteLength); Pallette.Add(Air); //else // palleteLength = for (int id = 0; id < palleteLength; id++) { uint stateId = (uint)ms.ReadVarInt(); BlockState state = BlockFactory.GetBlockState(stateId); Pallette.Put(state, (uint)id); // idToState.Set(id, state); // stateToId.Set(state, id); } } else { _bits = (int)Math.Ceiling(Math.Log2(BlockFactory.AllBlockstates.Count)); Pallette = new DirectPallete(); } int length = ms.ReadVarInt(); long[] dataArray = new long[length]; for (int i = 0; i < dataArray.Length; i++) { dataArray[i] = ms.ReadLong(); } Storage = new FlexibleStorage(_bits, dataArray); //Storage._data = dataArray; }
public override void Decode(MinecraftStream stream) { WindowId = (byte)stream.ReadByte(); ActionNumber = stream.ReadShort(); Accepted = stream.ReadBool(); }
public override void Decode(MinecraftStream stream) { WindowId = (byte)stream.ReadByte(); SlotId = stream.ReadShort(); Slot = stream.ReadSlot(); }