Use item in mainhand to get drops when using treefeller (#4781)

This commit is contained in:
destro174 2022-06-12 01:41:27 +02:00 committed by GitHub
parent fa82fe8e67
commit aa4011a226
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -281,6 +281,7 @@ public class WoodcuttingManager extends SkillManager {
Player player = getPlayer(); Player player = getPlayer();
int xp = 0; int xp = 0;
int processedLogCount = 0; int processedLogCount = 0;
ItemStack itemStack = player.getInventory().getItemInMainHand();
for (BlockState blockState : treeFellerBlocks) { for (BlockState blockState : treeFellerBlocks) {
int beforeXP = xp; int beforeXP = xp;
@ -299,7 +300,7 @@ public class WoodcuttingManager extends SkillManager {
xp += processTreeFellerXPGains(blockState, processedLogCount); xp += processTreeFellerXPGains(blockState, processedLogCount);
//Drop displaced block //Drop displaced block
Misc.spawnItemsFromCollection(getPlayer(), Misc.getBlockCenter(blockState), block.getDrops(), ItemSpawnReason.TREE_FELLER_DISPLACED_BLOCK); Misc.spawnItemsFromCollection(getPlayer(), Misc.getBlockCenter(blockState), block.getDrops(itemStack), ItemSpawnReason.TREE_FELLER_DISPLACED_BLOCK);
//Bonus Drops / Harvest lumber checks //Bonus Drops / Harvest lumber checks
processHarvestLumber(blockState); processHarvestLumber(blockState);
@ -307,7 +308,7 @@ public class WoodcuttingManager extends SkillManager {
//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)) {
Misc.spawnItemsFromCollection(getPlayer(), Misc.getBlockCenter(blockState), block.getDrops(), ItemSpawnReason.TREE_FELLER_DISPLACED_BLOCK); Misc.spawnItemsFromCollection(getPlayer(), Misc.getBlockCenter(blockState), block.getDrops(itemStack), ItemSpawnReason.TREE_FELLER_DISPLACED_BLOCK);
if(RankUtils.hasReachedRank(2, player, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD)) { if(RankUtils.hasReachedRank(2, player, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD)) {
if(mcMMO.p.getAdvancedConfig().isKnockOnWoodXPOrbEnabled()) { if(mcMMO.p.getAdvancedConfig().isKnockOnWoodXPOrbEnabled()) {
@ -319,7 +320,7 @@ public class WoodcuttingManager extends SkillManager {
} }
} else { } else {
Misc.spawnItemsFromCollection(getPlayer(), Misc.getBlockCenter(blockState), block.getDrops(), ItemSpawnReason.TREE_FELLER_DISPLACED_BLOCK, 1); Misc.spawnItemsFromCollection(getPlayer(), Misc.getBlockCenter(blockState), block.getDrops(itemStack), ItemSpawnReason.TREE_FELLER_DISPLACED_BLOCK, 1);
} }
} }