mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 00:04:42 +00:00
Drop blocks with no valid orientation when an object is rotated
A wall-mounted block that cannot face the new way put a null into the rotated object, and its tile was copied anyway. Rotation now omits the block and its tile, the module placement skips blocks that turn into air, and scaling reads geometry and volume under one read lock.
Upstream: 606aa2e70
This commit is contained in:
1 parent
8e0e6d7d45
commit
c3c137a33c
4 files changed
+181
-21
No files matched your search
@@ -107,7 +107,11 @@ public final class BlocksModule implements IrisModule {
|
||||
data = edited.data();
|
||||
blockEntity = edited.blockEntity();
|
||||
}
|
||||
data = prepared.rotate(data);
|
||||
BlockState rotated = prepared.rotate(data);
|
||||
if (isDroppedByRotation(data, rotated)) {
|
||||
return;
|
||||
}
|
||||
data = rotated;
|
||||
int x = placement.x() + offset.x();
|
||||
int y = anchorY + offset.y();
|
||||
int z = placement.z() + offset.z();
|
||||
@@ -152,6 +156,11 @@ public final class BlocksModule implements IrisModule {
|
||||
return data;
|
||||
}
|
||||
|
||||
/** A block that turned into air had no valid orientation: it is left out with its block entity, even for structure pieces that write air. */
|
||||
static boolean isDroppedByRotation(BlockState source, BlockState rotated) {
|
||||
return !AIR_MATERIALS.contains(source.material().toString()) && AIR_MATERIALS.contains(rotated.material().toString());
|
||||
}
|
||||
|
||||
private static boolean shouldWrite(PlacementWorld world, BlockState data, int x, int y, int z, boolean structurePiece) {
|
||||
if (world.has(data, BlockTrait.CUSTOM)) {
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user