Skip to content

Commit 1d96126

Browse files
committed
scan tool fixes (#719) port
Fix slab/domum handling and water handling and grass/dirt path handling and stairs handling
1 parent 1d334ab commit 1d96126

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

src/main/java/com/ldtteam/structurize/operations/RemoveBlockOperation.java

+5
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import net.minecraft.server.level.ServerLevel;
77
import net.minecraft.world.entity.player.Player;
88
import net.minecraft.world.item.ItemStack;
9+
import net.minecraft.world.level.block.Blocks;
910

1011
/**
1112
* Operation for removing one type of block.
@@ -37,6 +38,10 @@ protected void apply(final ServerLevel world, final BlockPos position)
3738
{
3839
storage.addPreviousDataFor(position, world);
3940
world.removeBlock(position, false);
41+
if (!world.getFluidState(position).isEmpty())
42+
{
43+
world.setBlock(position, Blocks.AIR.defaultBlockState(), 3);
44+
}
4045
storage.addPostDataFor(position, world);
4146
}
4247
}

src/main/java/com/ldtteam/structurize/placement/handlers/placement/PlacementHandlers.java

+15-10
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@
2323
import net.minecraft.world.level.block.*;
2424
import net.minecraft.world.level.block.entity.BlockEntity;
2525
import net.minecraft.world.level.block.state.BlockState;
26-
import net.minecraft.world.level.block.state.properties.BedPart;
27-
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
28-
import net.minecraft.world.level.block.state.properties.DoubleBlockHalf;
29-
import net.minecraft.world.level.block.state.properties.DripstoneThickness;
26+
import net.minecraft.world.level.block.state.properties.*;
3027
import net.minecraft.world.phys.AABB;
3128
import org.jetbrains.annotations.Nullable;
3229

@@ -341,9 +338,11 @@ public List<ItemStack> getRequiredItems(
341338
@Nullable final CompoundTag tileEntityData,
342339
final boolean complete)
343340
{
344-
final List<ItemStack> itemList = new ArrayList<>();
345-
itemList.add(new ItemStack(Blocks.DIRT));
346-
return itemList;
341+
if (complete)
342+
{
343+
return Collections.singletonList(new ItemStack(blockState.getBlock()));
344+
}
345+
return Collections.singletonList(new ItemStack(Blocks.DIRT));
347346
}
348347
}
349348

@@ -647,9 +646,11 @@ public List<ItemStack> getRequiredItems(
647646
@Nullable final CompoundTag tileEntityData,
648647
final boolean complete)
649648
{
650-
final List<ItemStack> itemList = new ArrayList<>();
651-
itemList.add(new ItemStack(Blocks.DIRT, 1));
652-
return itemList;
649+
if (complete)
650+
{
651+
return Collections.singletonList(new ItemStack(blockState.getBlock()));
652+
}
653+
return Collections.singletonList(new ItemStack(Blocks.DIRT));
653654
}
654655
}
655656

@@ -686,6 +687,10 @@ public List<ItemStack> getRequiredItems(
686687
@Nullable final CompoundTag tileEntityData,
687688
final boolean complete)
688689
{
690+
if (complete)
691+
{
692+
return Collections.singletonList(new ItemStack(blockState.getBlock()));
693+
}
689694
return new ArrayList<>();
690695
}
691696
}

0 commit comments

Comments
 (0)