Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert regression, restoring material based salvage permissions #5130

Merged
merged 10 commits into from
Dec 30, 2024
Prev Previous commit
Next Next commit
removed unnecessary getPlayer() calls.
clarified comment
clarified location variable name

Signed-off-by: Momshroom <Momshroom@gmail.com>
Momshroom committed May 23, 2024
commit b55ac121308622b94b375ade7d9ef2867a082bf3
Original file line number Diff line number Diff line change
@@ -316,22 +316,22 @@ private void dropTreeFellerLootFromBlocks(@NotNull Set<BlockState> treeFellerBlo
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
4 changes: 2 additions & 2 deletions src/main/java/com/gmail/nossr50/util/Misc.java
Original file line number Diff line number Diff line change
@@ -132,12 +132,12 @@ public static void spawnItemsFromCollection(@Nullable Player player, @NotNull Lo
* 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 <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);
spawnItem(player, spawnLocation, drop, itemSpawnReason);
}
}
}