From a73faf0c8b4bd7aee7b5b72f823eb0c230186e48 Mon Sep 17 00:00:00 2001 From: JOO200 Date: Wed, 5 Dec 2018 17:09:06 +0100 Subject: [PATCH] Check by setting blocks with BlockBagExtend for changed materials. --- .../extent/inventory/BlockBagExtent.java | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java index 21b790ee9..c4e563b87 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/inventory/BlockBagExtent.java @@ -86,25 +86,27 @@ public class BlockBagExtent extends AbstractDelegateExtent { if (blockBag != null) { BlockState existing = getExtent().getBlock(position); - if (!block.getBlockType().getMaterial().isAir()) { - try { - blockBag.fetchPlacedBlock(block.toImmutableState()); - } catch (UnplaceableBlockException e) { - return false; - } catch (BlockBagException e) { - if (!missingBlocks.containsKey(block.getBlockType())) { - missingBlocks.put(block.getBlockType(), 1); - } else { - missingBlocks.put(block.getBlockType(), missingBlocks.get(block.getBlockType()) + 1); + if (!block.getBlockType().equals(existing.getBlockType())) { + if (!block.getBlockType().getMaterial().isAir()) { + try { + blockBag.fetchPlacedBlock(block.toImmutableState()); + } catch (UnplaceableBlockException e) { + return false; + } catch (BlockBagException e) { + if (!missingBlocks.containsKey(block.getBlockType())) { + missingBlocks.put(block.getBlockType(), 1); + } else { + missingBlocks.put(block.getBlockType(), missingBlocks.get(block.getBlockType()) + 1); + } + return false; } - return false; } - } - if (!existing.getBlockType().getMaterial().isAir()) { - try { - blockBag.storeDroppedBlock(existing); - } catch (BlockBagException ignored) { + if (!existing.getBlockType().getMaterial().isAir()) { + try { + blockBag.storeDroppedBlock(existing); + } catch (BlockBagException ignored) { + } } } }