treat all airs as air

This commit is contained in:
ZacSharp 2021-03-09 11:53:43 +01:00
parent 113d26937d
commit 363519db02
No known key found for this signature in database
GPG Key ID: 9453647B005083A3

View File

@ -18,6 +18,7 @@
package baritone.api.schematic; package baritone.api.schematic;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockAir;
import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
@ -49,12 +50,12 @@ public class SubstituteSchematic extends AbstractSchematic {
return desired; return desired;
} }
List<Block> substitutes = substitutions.get(desiredBlock); List<Block> substitutes = substitutions.get(desiredBlock);
if (substitutes.contains(current.getBlock()) && !current.getBlock().equals(Blocks.AIR)) {// don't preserve air, it's almost always there and almost never wanted if (substitutes.contains(current.getBlock()) && !(current.getBlock() instanceof BlockAir)) {// don't preserve air, it's almost always there and almost never wanted
return withBlock(desired, current.getBlock()); return withBlock(desired, current.getBlock());
} }
for (Block substitute : substitutes) { for (Block substitute : substitutes) {
if (substitute.equals(Blocks.AIR)) { if (substitute instanceof BlockAir) {
return Blocks.AIR.getDefaultState(); // can always "place" air return current.getBlock() instanceof BlockAir ? current : Blocks.AIR.getDefaultState(); // can always "place" air
} }
for (IBlockState placeable : approxPlaceable) { for (IBlockState placeable : approxPlaceable) {
if (substitute.equals(placeable.getBlock())) { if (substitute.equals(placeable.getBlock())) {