mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-19 04:26:52 -04:00
Implement support for resetting block definitions.
This commit is contained in:
parent
d705593c36
commit
2e502ee8bb
@ -188,5 +188,21 @@ namespace ClassicalSharp {
|
|||||||
public string GetName( byte id ) {
|
public string GetName( byte id ) {
|
||||||
return names[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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -41,6 +41,7 @@ namespace ClassicalSharp {
|
|||||||
CpePlayerClick = 34,
|
CpePlayerClick = 34,
|
||||||
CpeDefineBlock = 35,
|
CpeDefineBlock = 35,
|
||||||
CpeDefineLiquid = 36,
|
CpeDefineLiquid = 36,
|
||||||
|
CpeRemoveBlockDefinition = 37,
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum CpeMessage {
|
public enum CpeMessage {
|
||||||
|
@ -116,7 +116,7 @@ namespace ClassicalSharp {
|
|||||||
readonly int[] packetSizes = {
|
readonly int[] packetSizes = {
|
||||||
131, 1, 1, 1028, 7, 9, 8, 74, 10, 7, 5, 4, 2,
|
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,
|
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 = {
|
static string[] clientExtensions = {
|
||||||
@ -643,6 +643,8 @@ namespace ClassicalSharp {
|
|||||||
{
|
{
|
||||||
byte block = reader.ReadUInt8();
|
byte block = reader.ReadUInt8();
|
||||||
BlockInfo info = game.BlockInfo;
|
BlockInfo info = game.BlockInfo;
|
||||||
|
info.ResetBlockInfo( block );
|
||||||
|
|
||||||
info.names[block] = reader.ReadAsciiString();
|
info.names[block] = reader.ReadAsciiString();
|
||||||
byte solidity = reader.ReadUInt8();
|
byte solidity = reader.ReadUInt8();
|
||||||
byte movementSpeed = reader.ReadUInt8();
|
byte movementSpeed = reader.ReadUInt8();
|
||||||
@ -676,6 +678,12 @@ namespace ClassicalSharp {
|
|||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
case PacketId.CpeRemoveBlockDefinition:
|
||||||
|
{
|
||||||
|
byte block = reader.ReadUInt8();
|
||||||
|
game.BlockInfo.ResetBlockInfo( block );
|
||||||
|
} break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw new NotImplementedException( "Unsupported packet:" + (PacketId)opcode );
|
throw new NotImplementedException( "Unsupported packet:" + (PacketId)opcode );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user