Use item in mainhand to get drops when using treefeller

This commit is contained in:
Len 2022-06-11 23:28:07 +02:00
parent fa82fe8e67
commit c581e60b1f

View File

@ -281,6 +281,7 @@ public class WoodcuttingManager extends SkillManager {
Player player = getPlayer();
int xp = 0;
int processedLogCount = 0;
ItemStack itemStack = player.getInventory().getItemInMainHand();
for (BlockState blockState : treeFellerBlocks) {
int beforeXP = xp;
@ -299,7 +300,7 @@ public class WoodcuttingManager extends SkillManager {
xp += processTreeFellerXPGains(blockState, processedLogCount);
//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
processHarvestLumber(blockState);
@ -307,7 +308,7 @@ public class WoodcuttingManager extends SkillManager {
//Drop displaced non-woodcutting XP blocks
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(mcMMO.p.getAdvancedConfig().isKnockOnWoodXPOrbEnabled()) {
@ -319,7 +320,7 @@ public class WoodcuttingManager extends SkillManager {
}
} 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);
}
}