diff --git a/ClassicalSharp/Blocks/BlockInfo.cs b/ClassicalSharp/Blocks/BlockInfo.cs index 0e4a9ff33..42118b422 100644 --- a/ClassicalSharp/Blocks/BlockInfo.cs +++ b/ClassicalSharp/Blocks/BlockInfo.cs @@ -188,5 +188,21 @@ namespace ClassicalSharp { public string GetName( byte id ) { return names[id]; } + + public void ResetBlockInfo( byte id ) { + isTransparent[id] = false; + isTranslucent[id] = false; + isOpaque[id] = true; + isSprite[id] = false; + isLiquid[id] = false; + heights[id] = 1; + blocksLight[id] = true; + emitsLight[id] = true; + names[id] = "Invalid"; + fogColours[id] = default( FastColour ); + fogDensities[id] = 0; + SetAll( 0, (Block)id ); + SetupCullingCache(); + } } } \ No newline at end of file diff --git a/ClassicalSharp/Network/Enums.cs b/ClassicalSharp/Network/Enums.cs index fee60ec22..d37813e95 100644 --- a/ClassicalSharp/Network/Enums.cs +++ b/ClassicalSharp/Network/Enums.cs @@ -41,6 +41,7 @@ namespace ClassicalSharp { CpePlayerClick = 34, CpeDefineBlock = 35, CpeDefineLiquid = 36, + CpeRemoveBlockDefinition = 37, } public enum CpeMessage { diff --git a/ClassicalSharp/Network/NetworkProcessor.cs b/ClassicalSharp/Network/NetworkProcessor.cs index 5d3a1f1ba..5a3234e09 100644 --- a/ClassicalSharp/Network/NetworkProcessor.cs +++ b/ClassicalSharp/Network/NetworkProcessor.cs @@ -116,7 +116,7 @@ namespace ClassicalSharp { readonly int[] packetSizes = { 131, 1, 1, 1028, 7, 9, 8, 74, 10, 7, 5, 4, 2, 66, 65, 2, 67, 69, 3, 2, 3, 134, 196, 130, 3, - 8, 86, 2, 4, 66, 69, 2, 8, 138, 0, 76, 78, + 8, 86, 2, 4, 66, 69, 2, 8, 138, 0, 76, 78, 2, }; static string[] clientExtensions = { @@ -643,6 +643,8 @@ namespace ClassicalSharp { { byte block = reader.ReadUInt8(); BlockInfo info = game.BlockInfo; + info.ResetBlockInfo( block ); + info.names[block] = reader.ReadAsciiString(); byte solidity = reader.ReadUInt8(); byte movementSpeed = reader.ReadUInt8(); @@ -676,6 +678,12 @@ namespace ClassicalSharp { } } break; + case PacketId.CpeRemoveBlockDefinition: + { + byte block = reader.ReadUInt8(); + game.BlockInfo.ResetBlockInfo( block ); + } break; + default: throw new NotImplementedException( "Unsupported packet:" + (PacketId)opcode ); }