Skip to content

Commit

Permalink
scan tool fixes (#719)
Browse files Browse the repository at this point in the history
Fix slab/domum handling and water handling and grass/dirt path handling and stairs handling
  • Loading branch information
Raycoms authored Feb 8, 2025
1 parent 52cbdc7 commit 98a9a16
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Blocks;

/**
* Operation for removing one type of block.
Expand Down Expand Up @@ -37,6 +38,10 @@ protected void apply(final ServerLevel world, final BlockPos position)
{
storage.addPreviousDataFor(position, world);
world.removeBlock(position, false);
if (!world.getFluidState(position).isEmpty())
{
world.setBlock(position, Blocks.AIR.defaultBlockState(), 3);
}
storage.addPostDataFor(position, world);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BedPart;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.DoubleBlockHalf;
import net.minecraft.world.level.block.state.properties.DripstoneThickness;
import net.minecraft.world.level.block.state.properties.*;
import net.minecraft.world.phys.AABB;
import org.jetbrains.annotations.Nullable;

Expand Down Expand Up @@ -342,9 +339,11 @@ public List<ItemStack> getRequiredItems(
@Nullable final CompoundTag tileEntityData,
final boolean complete)
{
final List<ItemStack> itemList = new ArrayList<>();
itemList.add(new ItemStack(Blocks.DIRT));
return itemList;
if (complete)
{
return Collections.singletonList(new ItemStack(blockState.getBlock()));
}
return Collections.singletonList(new ItemStack(Blocks.DIRT));
}
}

Expand Down Expand Up @@ -648,9 +647,11 @@ public List<ItemStack> getRequiredItems(
@Nullable final CompoundTag tileEntityData,
final boolean complete)
{
final List<ItemStack> itemList = new ArrayList<>();
itemList.add(new ItemStack(Blocks.DIRT, 1));
return itemList;
if (complete)
{
return Collections.singletonList(new ItemStack(blockState.getBlock()));
}
return Collections.singletonList(new ItemStack(Blocks.DIRT));
}
}

Expand Down Expand Up @@ -687,6 +688,10 @@ public List<ItemStack> getRequiredItems(
@Nullable final CompoundTag tileEntityData,
final boolean complete)
{
if (complete)
{
return Collections.singletonList(new ItemStack(blockState.getBlock()));
}
return new ArrayList<>();
}
}
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/ldtteam/structurize/util/BlockUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,7 @@ else if (item instanceof BlockItem)
// place
world.setBlock(here, Blocks.COBBLESTONE.defaultBlockState(), Block.UPDATE_CLIENTS);
world.setBlock(here, newState, Constants.UPDATE_FLAG);
world.getBlockEntity(here).applyComponentsFromItemStack(stackToPlace);
targetBlock.setPlacedBy(world, here, newState, fakePlayer, stackToPlace);
}
else if (item instanceof BucketItem)
Expand Down

0 comments on commit 98a9a16

Please sign in to comment.