mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 19:45:23 -04:00
Don't restrict size of custom blocks to between 0 and 1, allow from -7.9 to 7.9
This commit is contained in:
parent
2f511c96ee
commit
9da34eab7f
@ -66,12 +66,12 @@ namespace ClassicalSharp.Network.Protocols {
|
||||
BlockID block = HandleDefineBlockCommonStart(reader, net.cpeData.blockDefsExtVer >= 2);
|
||||
Vector3 min, max;
|
||||
|
||||
min.X = reader.ReadUInt8() / 16f; Utils.Clamp(ref min.X, 0, 1);
|
||||
min.Y = reader.ReadUInt8() / 16f; Utils.Clamp(ref min.Y, 0, 1);
|
||||
min.Z = reader.ReadUInt8() / 16f; Utils.Clamp(ref min.Z, 0, 1);
|
||||
max.X = reader.ReadUInt8() / 16f; Utils.Clamp(ref max.X, 0, 1);
|
||||
max.Y = reader.ReadUInt8() / 16f; Utils.Clamp(ref max.Y, 0, 1);
|
||||
max.Z = reader.ReadUInt8() / 16f; Utils.Clamp(ref max.Z, 0, 1);
|
||||
min.X = reader.ReadInt8() / 16f;
|
||||
min.Y = reader.ReadInt8() / 16f;
|
||||
min.Z = reader.ReadInt8() / 16f;
|
||||
max.X = reader.ReadInt8() / 16f;
|
||||
max.Y = reader.ReadInt8() / 16f;
|
||||
max.Z = reader.ReadInt8() / 16f;
|
||||
|
||||
BlockInfo.MinBB[block] = min;
|
||||
BlockInfo.MaxBB[block] = max;
|
||||
|
@ -1478,18 +1478,17 @@ static void BlockDefs_UndefineBlock(uint8_t* data) {
|
||||
Event_RaiseVoid(&BlockEvents_BlockDefChanged);
|
||||
}
|
||||
|
||||
#define BlockDefs_ReadCoord(x) x = *data++ / 16.0f; if (x > 1.0f) x = 1.0f;
|
||||
static void BlockDefs_DefineBlockExt(uint8_t* data) {
|
||||
Vector3 minBB, maxBB;
|
||||
BlockID block = BlockDefs_DefineBlockCommonStart(&data, cpe_blockDefsExtVer >= 2);
|
||||
|
||||
BlockDefs_ReadCoord(minBB.X);
|
||||
BlockDefs_ReadCoord(minBB.Y);
|
||||
BlockDefs_ReadCoord(minBB.Z);
|
||||
minBB.X = (int8_t)(*data++) / 16.0f;
|
||||
minBB.Y = (int8_t)(*data++) / 16.0f;
|
||||
minBB.Z = (int8_t)(*data++) / 16.0f;
|
||||
|
||||
BlockDefs_ReadCoord(maxBB.X);
|
||||
BlockDefs_ReadCoord(maxBB.Y);
|
||||
BlockDefs_ReadCoord(maxBB.Z);
|
||||
maxBB.X = (int8_t)(*data++) / 16.0f;
|
||||
maxBB.Y = (int8_t)(*data++) / 16.0f;
|
||||
maxBB.Z = (int8_t)(*data++) / 16.0f;
|
||||
|
||||
Block_MinBB[block] = minBB;
|
||||
Block_MaxBB[block] = maxBB;
|
||||
|
Loading…
x
Reference in New Issue
Block a user