Skip to content

Commit c831bfe

Browse files
authored
Make non-legacy blocks' type/data values -1, to allow overriding non-legacy blocks with air in //generate (#2901)
* In //g, allow overriding non-legacy blocks with air Previously, it was impossible to override a non-legacy block (i.e. one that was introduced after the switch to string IDs) with air. This was due to the fact that non-legacy blocks and air had the same type id (0). This change gives them separate type ids, making it possible to override non-legacy blocks with air. * Make query functions return type/data values of -1 for non-legacy blocks This matches the new behaviour of the type/data variables in //generate
1 parent aa778af commit c831bfe

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2481,8 +2481,8 @@ protected BaseBlock getMaterial(int x, int y, int z, BaseBlock defaultMaterial)
24812481

24822482
try {
24832483
int[] legacy = LegacyMapper.getInstance().getLegacyFromBlock(defaultMaterial.toImmutableState());
2484-
int typeVar = 0;
2485-
int dataVar = 0;
2484+
int typeVar = -1;
2485+
int dataVar = -1;
24862486
if (legacy != null) {
24872487
typeVar = legacy[0];
24882488
if (legacy.length > 1) {

worldedit-core/src/main/java/com/sk89q/worldedit/regions/shape/WorldEditExpressionEnvironment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public Vector3 toWorldRel(double x, double y, double z) {
6060

6161
private int getLegacy(BlockVector3 position, int index) {
6262
final int[] legacy = LegacyMapper.getInstance().getLegacyFromBlock(extent.getBlock(position).toImmutableState());
63-
return legacy == null ? 0 : legacy[index];
63+
return legacy == null ? -1 : legacy[index];
6464
}
6565

6666
@Override

0 commit comments

Comments
 (0)