Skip to content

Commit

Permalink
This should work (#4234)
Browse files Browse the repository at this point in the history
  • Loading branch information
JustAHuman-xD authored Sep 6, 2024
1 parent 2fd0f8a commit 7d4ed2b
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,18 @@ public void onBlockPlaceExisting(BlockPlaceEvent e) {
Block block = e.getBlock();

// Fixes #2636 - This will solve the "ghost blocks" issue
if (e.getBlockReplacedState().getType().isAir()) {
if (e.getBlockReplacedState().getType().isAir() && BlockStorage.hasBlockInfo(block) && !Slimefun.getTickerTask().isDeletedSoon(block.getLocation())) {
SlimefunItem sfItem = BlockStorage.check(block);

if (sfItem != null && !Slimefun.getTickerTask().isDeletedSoon(block.getLocation())) {
if (sfItem != null) {
for (ItemStack item : sfItem.getDrops()) {
if (item != null && !item.getType().isAir()) {
block.getWorld().dropItemNaturally(block.getLocation(), item);
}
}

BlockStorage.clearBlockInfo(block);
}

BlockStorage.clearBlockInfo(block);
} else if (BlockStorage.hasBlockInfo(e.getBlock())) {
// If there is no air (e.g. grass) then don't let the block be placed
e.setCancelled(true);
Expand Down

0 comments on commit 7d4ed2b

Please sign in to comment.