mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
fix: correct global state indexing in block shape processing
- Adjusted the indexing logic in BlockShapes.cs to ensure proper mapping of state counts to shape IDs. - Introduced a global state offset to accurately reference shape IDs in the list, preventing out-of-bounds errors during shape assignment. These changes enhance the reliability of block shape processing in the physics engine.
This commit is contained in:
parent
38e86eb209
commit
3afbae4f89
1 changed files with 4 additions and 2 deletions
|
|
@ -173,6 +173,7 @@ namespace MinecraftClient.Physics
|
|||
if (!prismarineBlocks.TryGetValue(snakeName, out var blockShapeData))
|
||||
continue;
|
||||
|
||||
int globalStateOffset = 0;
|
||||
foreach (var (start, end) in kvp.Value)
|
||||
{
|
||||
int stateCount = end - start + 1;
|
||||
|
|
@ -185,12 +186,13 @@ namespace MinecraftClient.Physics
|
|||
}
|
||||
else if (blockShapeData is List<int> shapeIdList)
|
||||
{
|
||||
for (int i = 0; i < stateCount && i < shapeIdList.Count; i++)
|
||||
for (int i = 0; i < stateCount && (globalStateOffset + i) < shapeIdList.Count; i++)
|
||||
{
|
||||
int shapeId = shapeIdList[i];
|
||||
int shapeId = shapeIdList[globalStateOffset + i];
|
||||
stateToShape[start + i] = prismarineShapes.GetValueOrDefault(shapeId, EmptyArray);
|
||||
}
|
||||
}
|
||||
globalStateOffset += stateCount;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue