geforkt von Mirrors/FastAsyncWorldEdit
Fix rotation of item frames
Dieser Commit ist enthalten in:
Ursprung
15d10bee30
Commit
1a3ae37b73
@ -131,6 +131,7 @@ public class ExtentEntityCopy implements EntityFunction {
|
|||||||
boolean hasTilePosition = tag.containsKey("TileX") && tag.containsKey("TileY") && tag.containsKey("TileZ");
|
boolean hasTilePosition = tag.containsKey("TileX") && tag.containsKey("TileY") && tag.containsKey("TileZ");
|
||||||
boolean hasDirection = tag.containsKey("Direction");
|
boolean hasDirection = tag.containsKey("Direction");
|
||||||
boolean hasLegacyDirection = tag.containsKey("Dir");
|
boolean hasLegacyDirection = tag.containsKey("Dir");
|
||||||
|
boolean hasFacing = tag.containsKey("Facing");
|
||||||
|
|
||||||
if (hasTilePosition) {
|
if (hasTilePosition) {
|
||||||
Vector tilePosition = new Vector(tag.asInt("TileX"), tag.asInt("TileY"), tag.asInt("TileZ"));
|
Vector tilePosition = new Vector(tag.asInt("TileX"), tag.asInt("TileY"), tag.asInt("TileZ"));
|
||||||
@ -141,15 +142,25 @@ public class ExtentEntityCopy implements EntityFunction {
|
|||||||
.putInt("TileY", newTilePosition.getBlockY())
|
.putInt("TileY", newTilePosition.getBlockY())
|
||||||
.putInt("TileZ", newTilePosition.getBlockZ());
|
.putInt("TileZ", newTilePosition.getBlockZ());
|
||||||
|
|
||||||
if (hasDirection || hasLegacyDirection) {
|
if (hasDirection || hasLegacyDirection || hasFacing) {
|
||||||
int d = hasDirection ? tag.asInt("Direction") : MCDirections.fromLegacyHanging((byte) tag.asInt("Dir"));
|
int d;
|
||||||
|
if (hasDirection) {
|
||||||
|
d = tag.asInt("Direction");
|
||||||
|
} else if (hasLegacyDirection) {
|
||||||
|
d = MCDirections.fromLegacyHanging((byte) tag.asInt("Dir"));
|
||||||
|
} else {
|
||||||
|
d = tag.asInt("Facing");
|
||||||
|
}
|
||||||
|
|
||||||
Direction direction = MCDirections.fromHanging(d);
|
Direction direction = MCDirections.fromHanging(d);
|
||||||
|
|
||||||
if (direction != null) {
|
if (direction != null) {
|
||||||
Vector vector = transform.apply(direction.toVector()).subtract(transform.apply(Vector.ZERO)).normalize();
|
Vector vector = transform.apply(direction.toVector()).subtract(transform.apply(Vector.ZERO)).normalize();
|
||||||
Direction newDirection = Direction.findClosest(vector, Flag.CARDINAL);
|
Direction newDirection = Direction.findClosest(vector, Flag.CARDINAL);
|
||||||
|
|
||||||
builder.putByte("Direction", (byte) MCDirections.toHanging(newDirection));
|
byte hangingByte = (byte) MCDirections.toHanging(newDirection);
|
||||||
|
builder.putByte("Direction", hangingByte);
|
||||||
|
builder.putByte("Facing", hangingByte);
|
||||||
builder.putByte("Dir", MCDirections.toLegacyHanging(MCDirections.toHanging(newDirection)));
|
builder.putByte("Dir", MCDirections.toLegacyHanging(MCDirections.toHanging(newDirection)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren