diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java index 85fbde830b..49c78aafbf 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -2746,7 +2746,7 @@ public int thaw(BlockVector3 position, double radius, int height) if (setBlock(mutable, air)) { if (y > getMinY()) { BlockState block = getBlock(mutable2); - if (block.getStates().containsKey(snowy)) { + if (block.getBlockType().hasPropertyOfType(snowy.getKey(), snowy.getClass())) { if (setBlock(mutable2, block.with(snowy, false))) { affected++; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/SnowSimulator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/SnowSimulator.java index 962fb3c7d3..f24acc7fb9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/SnowSimulator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/SnowSimulator.java @@ -27,10 +27,10 @@ import com.sk89q.worldedit.registry.state.EnumProperty; import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; import java.util.Locale; -import java.util.Map; public class SnowSimulator implements LayerFunction { @@ -120,20 +120,19 @@ public boolean apply(BlockVector3 position, int depth) throws WorldEditException abovePosition) > 10) { return false; } else if (!block.getBlockType().getMaterial().isFullCube()) { - Map, Object> states = block.getStates(); - if (states.containsKey(slab) && block.getState(slab).equalsIgnoreCase("bottom")) { + BlockType type = block.getBlockType(); + if (type.hasPropertyOfType(slab.getKey(), slab.getClass()) && block.getState(slab).equalsIgnoreCase("bottom")) { return false; - } else if (states.containsKey(trapdoorOpen) && states.containsKey(trapdoor) && (block.getState(trapdoorOpen) - || block.getState(trapdoor).equalsIgnoreCase("bottom"))) { + } else if ((type.hasPropertyOfType(trapdoorOpen.getKey(), trapdoorOpen.getClass()) && block.getState(trapdoorOpen)) || + (type.hasPropertyOfType(trapdoor.getKey(), trapdoor.getClass()) && block.getState(trapdoor).equalsIgnoreCase("bottom"))) { return false; - } else if (states.containsKey(stair) && block.getState(stair).equalsIgnoreCase("bottom")) { + } else if (type.hasPropertyOfType(stair.getKey(), stair.getClass()) && block.getState(stair).equalsIgnoreCase("bottom")) { return false; } else { return false; } //FAWE end - } else if (!block.getBlockType().id().toLowerCase(Locale.ROOT).contains("ice") && block - .getBlockType() + } else if (!block.getBlockType().id().toLowerCase(Locale.ROOT).contains("ice") && block.getBlockType() .getMaterial() .isTranslucent()) { return false; @@ -144,14 +143,14 @@ public boolean apply(BlockVector3 position, int depth) throws WorldEditException // We've hit the highest layer (If it doesn't contain current + 2 it means it's 1 away from full) if (!snowLayersProperty.getValues().contains(currentHeight + 2)) { if (this.extent.setBlock(abovePosition, snowBlock)) { - if (block.getStates().containsKey(snowy)) { + if (block.getBlockType().hasPropertyOfType(snowy.getKey(), snowy.getClass())) { this.extent.setBlock(position, block.with(snowy, true)); } this.affected++; } } else { if (this.extent.setBlock(abovePosition, above.with(snowLayersProperty, currentHeight + 1))) { - if (block.getStates().containsKey(snowy)) { + if (block.getBlockType().hasPropertyOfType(snowy.getKey(), snowy.getClass())) { this.extent.setBlock(position, block.with(snowy, true)); } this.affected++; @@ -160,7 +159,7 @@ public boolean apply(BlockVector3 position, int depth) throws WorldEditException return false; } if (this.extent.setBlock(abovePosition, snow)) { - if (block.getStates().containsKey(snowy)) { + if (block.getBlockType().hasPropertyOfType(snowy.getKey(), snowy.getClass())) { this.extent.setBlock(position, block.with(snowy, true)); } this.affected++; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java index e72d0b0e3f..b66142e934 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java @@ -254,7 +254,8 @@ public boolean hasProperty(PropertyKey key) { * @param propertyType the expected type of the property * @since TODO */ - public boolean hasPropertyOfType(PropertyKey key, Class propertyType) { + @SuppressWarnings("rawtypes") + public boolean hasPropertyOfType(PropertyKey key, Class propertyType) { int ordinal = key.getId(); Property property; return this.settings.propertiesMapArr.length > ordinal