Skip to content

Commit 98a9a16

Browse files
authored
scan tool fixes (#719)
Fix slab/domum handling and water handling and grass/dirt path handling and stairs handling
1 parent 52cbdc7 commit 98a9a16

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-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

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

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

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

src/main/java/com/ldtteam/structurize/util/BlockUtils.java

+1
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,7 @@ else if (item instanceof BlockItem)
553553
// place
554554
world.setBlock(here, Blocks.COBBLESTONE.defaultBlockState(), Block.UPDATE_CLIENTS);
555555
world.setBlock(here, newState, Constants.UPDATE_FLAG);
556+
world.getBlockEntity(here).applyComponentsFromItemStack(stackToPlace);
556557
targetBlock.setPlacedBy(world, here, newState, fakePlayer, stackToPlace);
557558
}
558559
else if (item instanceof BucketItem)

0 commit comments

Comments
 (0)