mirror of
https://github.com/EngineHub/WorldEdit.git
synced 2025-04-06 14:30:42 +08:00
Fix paintings not getting rotated correctly
Co-authored-by: Octavia Togami <octavia.togami@gmail.com>
This commit is contained in:
parent
6686552ecf
commit
a695bb81fe
@ -186,7 +186,7 @@ public class ExtentEntityCopy implements EntityFunction {
|
||||
.putInt("TileY", newTilePosition.y())
|
||||
.putInt("TileZ", newTilePosition.z());
|
||||
|
||||
if (tag.value().get("Facing") instanceof LinNumberTag<?> tagFacing) {
|
||||
if (tryGetFacingData(tag) instanceof FacingTagData(String facingKey, LinNumberTag<?> tagFacing)) {
|
||||
boolean isPainting = state.getType() == EntityTypes.PAINTING; // Paintings have different facing values
|
||||
Direction direction = isPainting
|
||||
? MCDirections.fromHorizontalHanging(tagFacing.value().intValue())
|
||||
@ -202,7 +202,7 @@ public class ExtentEntityCopy implements EntityFunction {
|
||||
? MCDirections.toHorizontalHanging(newDirection)
|
||||
: MCDirections.toHanging(newDirection)
|
||||
);
|
||||
builder.putByte("Facing", facingValue);
|
||||
builder.putByte(facingKey, facingValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -213,4 +213,17 @@ public class ExtentEntityCopy implements EntityFunction {
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
private record FacingTagData(String facingKey, LinNumberTag<?> tagFacing) {
|
||||
}
|
||||
|
||||
private static FacingTagData tryGetFacingData(LinCompoundTag tag) {
|
||||
if (tag.value().get("Facing") instanceof LinNumberTag<?> tagFacingCapital) {
|
||||
return new FacingTagData("Facing", tagFacingCapital);
|
||||
} else if (tag.value().get("facing") instanceof LinNumberTag<?> tagFacingLower) {
|
||||
return new FacingTagData("facing", tagFacingLower);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user