From b55ac121308622b94b375ade7d9ef2867a082bf3 Mon Sep 17 00:00:00 2001 From: Momshroom Date: Thu, 23 May 2024 18:58:24 -0500 Subject: [PATCH] removed unnecessary getPlayer() calls. clarified comment clarified location variable name Signed-off-by: Momshroom --- .../nossr50/skills/woodcutting/WoodcuttingManager.java | 10 +++++----- src/main/java/com/gmail/nossr50/util/Misc.java | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/skills/woodcutting/WoodcuttingManager.java b/src/main/java/com/gmail/nossr50/skills/woodcutting/WoodcuttingManager.java index 34644086d..760a448c7 100644 --- a/src/main/java/com/gmail/nossr50/skills/woodcutting/WoodcuttingManager.java +++ b/src/main/java/com/gmail/nossr50/skills/woodcutting/WoodcuttingManager.java @@ -316,22 +316,22 @@ public class WoodcuttingManager extends SkillManager { xp += processTreeFellerXPGains(blockState, processedLogCount); //Drop displaced block - Misc.spawnItemsFromCollection(getPlayer(), Misc.getBlockCenter(blockState), block.getDrops(itemStack), ItemSpawnReason.TREE_FELLER_DISPLACED_BLOCK); + Misc.spawnItemsFromCollection(player, Misc.getBlockCenter(blockState), block.getDrops(itemStack), ItemSpawnReason.TREE_FELLER_DISPLACED_BLOCK); //Bonus Drops / Harvest lumber checks processBonusDropCheck(blockState); } else if (BlockUtils.isNonWoodPartOfTree(blockState)) { // 75% of the time do not drop leaf blocks if (ThreadLocalRandom.current().nextInt(100) > 75) { - Misc.spawnItemsFromCollection(getPlayer(), + Misc.spawnItemsFromCollection(player, Misc.getBlockCenter(blockState), block.getDrops(itemStack), ItemSpawnReason.TREE_FELLER_DISPLACED_BLOCK); } - // drop saplings as occur in rest if Knock on Wood unlocked. + // if KnockOnWood is unlocked, then drop any saplings from the remaining blocks else if (RankUtils.hasUnlockedSubskill(player, SubSkillType.WOODCUTTING_KNOCK_ON_WOOD)) { - Misc.spawnItemIfSapling(getPlayer(), Misc.getBlockCenter(blockState), - block.getDrops(itemStack),ItemSpawnReason.TREE_FELLER_DISPLACED_BLOCK);; + Misc.spawnItemIfSapling(player, Misc.getBlockCenter(blockState), + block.getDrops(itemStack),ItemSpawnReason.TREE_FELLER_DISPLACED_BLOCK); } //Drop displaced non-woodcutting XP blocks diff --git a/src/main/java/com/gmail/nossr50/util/Misc.java b/src/main/java/com/gmail/nossr50/util/Misc.java index a57aaf7ee..9a924c156 100644 --- a/src/main/java/com/gmail/nossr50/util/Misc.java +++ b/src/main/java/com/gmail/nossr50/util/Misc.java @@ -132,12 +132,12 @@ 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) { + public static void spawnItemIfSapling(@NotNull Player player, @NotNull Location spawnLocation, @NotNull Collection 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); + spawnItem(player, spawnLocation, drop, itemSpawnReason); } } }