mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-11-03 18:43:43 +01:00 
			
		
		
		
	Actually don't reduce sapling drop if KnockOnWood unlocked. (Prior fix didn't)
Signed-off-by: Momshroom <Momshroom@gmail.com>
This commit is contained in:
		@@ -322,13 +322,17 @@ public class WoodcuttingManager extends SkillManager {
 | 
				
			|||||||
                processBonusDropCheck(blockState);
 | 
					                processBonusDropCheck(blockState);
 | 
				
			||||||
            } else if (BlockUtils.isNonWoodPartOfTree(blockState)) {
 | 
					            } else if (BlockUtils.isNonWoodPartOfTree(blockState)) {
 | 
				
			||||||
                // 75% of the time do not drop leaf blocks
 | 
					                // 75% of the time do not drop leaf blocks
 | 
				
			||||||
                if (blockState.getType().getKey().getKey().toLowerCase().contains("sapling")
 | 
					                if (ThreadLocalRandom.current().nextInt(100) > 75) {
 | 
				
			||||||
                        || ThreadLocalRandom.current().nextInt(100) > 75) {
 | 
					 | 
				
			||||||
                    Misc.spawnItemsFromCollection(getPlayer(),
 | 
					                    Misc.spawnItemsFromCollection(getPlayer(),
 | 
				
			||||||
                            Misc.getBlockCenter(blockState),
 | 
					                            Misc.getBlockCenter(blockState),
 | 
				
			||||||
                            block.getDrops(itemStack),
 | 
					                            block.getDrops(itemStack),
 | 
				
			||||||
                            ItemSpawnReason.TREE_FELLER_DISPLACED_BLOCK);
 | 
					                            ItemSpawnReason.TREE_FELLER_DISPLACED_BLOCK);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					                // drop saplings as occur in rest if Knock on Wood unlocked.
 | 
				
			||||||
 | 
					                else if (RankUtils.hasUnlockedSubskill(player, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD)) {
 | 
				
			||||||
 | 
					                    Misc.spawnItemIfSapling(getPlayer(), Misc.getBlockCenter(blockState),
 | 
				
			||||||
 | 
					                            block.getDrops(itemStack),ItemSpawnReason.TREE_FELLER_DISPLACED_BLOCK);;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                //Drop displaced non-woodcutting XP blocks
 | 
					                //Drop displaced non-woodcutting XP blocks
 | 
				
			||||||
                if (RankUtils.hasUnlockedSubskill(player, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD)) {
 | 
					                if (RankUtils.hasUnlockedSubskill(player, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD)) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -128,6 +128,20 @@ public final class Misc {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * Drops the item from the item stack only if it is a sapling (or equivalent)
 | 
				
			||||||
 | 
					     * Needed for TreeFeller
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public static void spawnItemIfSapling(@NotNull Player player, @NotNull Location location, @NotNull Collection < ItemStack > drops, @NotNull ItemSpawnReason itemSpawnReason) {
 | 
				
			||||||
 | 
					        String dropString;
 | 
				
			||||||
 | 
					        for (ItemStack drop : drops) {
 | 
				
			||||||
 | 
					            dropString = drop.getType().getKey().getKey();
 | 
				
			||||||
 | 
					            if (dropString.contains("sapling") || dropString.contains("propagule")) {
 | 
				
			||||||
 | 
					                Misc.spawnItem(player, location, drop, itemSpawnReason);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * Drop items at a given location.
 | 
					     * Drop items at a given location.
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user