diff --git a/Changelog.txt b/Changelog.txt index 53e4b03bc..26f88d6a7 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,4 +1,5 @@ Version 2.1.202 + Fixed a bug where mcMMO marked bonemealed Azalea trees as unnatural (and thus did not give XP or get affected by Tree Feller) Added Amethyst_Block to experience.yml for Mining Added Flowering Azalea Leaves to Tree Feller's white list Fixed a bug where mcMMO didn't appropriately flag blocks as natural in some tree growing events @@ -8,9 +9,8 @@ Version 2.1.202 Updated zh_CN locale (thanks GhostDC) Added some settings for over fishing (Settings are in experience.yml under Fishing_ExploitFix_Options - thanks tunagohan) - NOTES: - This means tree feller will destroy flowering azalea leaves during its ability + This means tree feller will correctly traverse flowering azalea leaves during its ability Version 2.1.201 Tweaked the visual/audio effect for Rupture diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index 0953f00c3..5354d644a 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -238,7 +238,10 @@ public class BlockListener implements Listener { WorldCompatibilityLayer worldCompatibilityLayer = mcMMO.getCompatibilityManager().getWorldCompatibilityLayer(); if(BlockUtils.isWithinWorldBounds(worldCompatibilityLayer, block)) { - mcMMO.getPlaceStore().setTrue(blockState); + //NOTE: BlockMultiPlace has its own logic so don't handle anything that would overlap + if (!(event instanceof BlockMultiPlaceEvent)) { + mcMMO.getPlaceStore().setTrue(blockState); + } } @@ -276,7 +279,16 @@ public class BlockListener implements Listener { /* Check if the blocks placed should be monitored so they do not give out XP in the future */ if(BlockUtils.isWithinWorldBounds(worldCompatibilityLayer, block)) { - mcMMO.getPlaceStore().setTrue(blockState); + //Updated: 10/5/2021 + //Note: For some reason Azalea trees trigger this event but no other tree does (as of 10/5/2021) but if this changes in the future we may need to update this + if(BlockUtils.isPartOfTree(event.getBlockPlaced())) { + return; + } + + //Track unnatural blocks + for(BlockState replacedStates : event.getReplacedBlockStates()) { + mcMMO.getPlaceStore().setTrue(replacedStates); + } } } } diff --git a/src/main/java/com/gmail/nossr50/util/BlockUtils.java b/src/main/java/com/gmail/nossr50/util/BlockUtils.java index c9a00f015..566c95c3a 100644 --- a/src/main/java/com/gmail/nossr50/util/BlockUtils.java +++ b/src/main/java/com/gmail/nossr50/util/BlockUtils.java @@ -285,8 +285,8 @@ public final class BlockUtils { return true; } - public static boolean isPartOfTree(Block rayCast) { - return hasWoodcuttingXP(rayCast.getState()) || isNonWoodPartOfTree(rayCast.getType()); + public static boolean isPartOfTree(Block block) { + return hasWoodcuttingXP(block.getState()) || isNonWoodPartOfTree(block.getType()); } public static boolean isWithinWorldBounds(@NotNull WorldCompatibilityLayer worldCompatibilityLayer, @NotNull Block block) {