mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-06 20:56:41 +00:00
Fix flipping of chests and stairs (#526)
* Fix flipping of chests and stairs * Check if the new property value is valid before updating * Only for horizontal flips double chests/stairs should be modified
This commit is contained in:
committed by
Matthew Miller
parent
23a3929051
commit
89bc664f69
@ -25,6 +25,7 @@ import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.registry.state.BooleanProperty;
|
||||
import com.sk89q.worldedit.registry.state.DirectionalProperty;
|
||||
@ -162,6 +163,38 @@ public class BlockTransformExtent extends AbstractDelegateExtent {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (property.getName().equals("type") && transform instanceof AffineTransform) {
|
||||
// chests
|
||||
if (((AffineTransform) transform).isHorizontalFlip()) {
|
||||
String value = (String) block.getState(property);
|
||||
String newValue = null;
|
||||
if ("left".equals(value)) {
|
||||
newValue = "right";
|
||||
} else if ("right".equals(value)) {
|
||||
newValue = "left";
|
||||
}
|
||||
if (newValue != null && enumProp.getValues().contains(newValue)) {
|
||||
result = result.with(enumProp, newValue);
|
||||
}
|
||||
}
|
||||
} else if (property.getName().equals("shape") && transform instanceof AffineTransform) {
|
||||
// stairs
|
||||
if (((AffineTransform) transform).isHorizontalFlip()) {
|
||||
String value = (String) block.getState(property);
|
||||
String newValue = null;
|
||||
if ("outer_left".equals(value)) {
|
||||
newValue = "outer_right";
|
||||
} else if ("outer_right".equals(value)) {
|
||||
newValue = "outer_left";
|
||||
} else if ("inner_left".equals(value)) {
|
||||
newValue = "inner_right";
|
||||
} else if ("inner_right".equals(value)) {
|
||||
newValue = "inner_left";
|
||||
}
|
||||
if (newValue != null && enumProp.getValues().contains(newValue)) {
|
||||
result = result.with(enumProp, newValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (property instanceof IntegerProperty) {
|
||||
IntegerProperty intProp = (IntegerProperty) property;
|
||||
|
Reference in New Issue
Block a user