Skip to content

Commit

Permalink
v7.3.56 - drop items if the auto adding did not fit - defaults to fal…
Browse files Browse the repository at this point in the history
…se for backwards compatibility!
  • Loading branch information
slipcor committed Jun 11, 2024
1 parent 647b747 commit a360cce
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions doc/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## v7.3 - API Expansion

- v7.3.56 - drop items if the auto adding did not fit - defaults to false for backwards compatibility!
- v7.3.55 - clarify debug for custom drops deny reason
- v7.3.54 - fix a diagonal loop determination issue resulting in false negative tree validity checks
- v7.3.53 - properly reset Toggle varibale when toggling functionality back on - affects "Remember Toggle Status"
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ It also will take down an entire tree when it is enabled in the config.

## Changelog

- v7.3.55 - clarify debug for custom drops deny reason
- v7.3.56 - drop items if the auto adding did not fit - defaults to false for backwards compatibility!
- [read more](doc/changelog.md)

***
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1946,7 +1946,12 @@ private void maybeBreakBlock(Block block, ItemStack tool, Player player,
player.incrementStatistic(Statistic.PICKUP, blockMaterial);
}
List<ItemStack> drops = new ArrayList<>(block.getDrops(new ItemStack(tool == null?Material.AIR:tool.getType(), 1)));
player.getInventory().addItem(drops.toArray(new ItemStack[0]));
Map<Integer, ItemStack> didNotFit = player.getInventory().addItem(drops.toArray(new ItemStack[0]));
if (config.getBoolean(TreeConfig.CFG.AUTOMATIC_DESTRUCTION_AUTO_ADD_DROP_FAILED)) {
for (ItemStack item : didNotFit.values()) {
player.getWorld().dropItem(player.getLocation(), item);
}
}
block.setType(Material.AIR, true);
} else {
debug.i("not auto adding!");
Expand Down
1 change: 1 addition & 0 deletions src/main/java/net/slipcor/treeassist/yml/TreeConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public enum CFG implements ConfigEntry {
AUTOMATIC_DESTRUCTION_TOOL_DAMAGE_FOR_LEAVES("Automatic Destruction.Apply Tool Damage For Leaves", true, "Damage the player's tool for leaves broken automatically"),
AUTOMATIC_DESTRUCTION_AUTO_ADD_TO_INVENTORY("Automatic Destruction.Auto Add To Inventory", false, "Add the tree drops to the player's inventory"),
AUTOMATIC_DESTRUCTION_AUTO_ADD_ONLY_LOGS_TO_INVENTORY("Automatic Destruction.Auto Add Only Logs To Inventory", false, "Only add the logs to the player's inventory"),
AUTOMATIC_DESTRUCTION_AUTO_ADD_DROP_FAILED("Automatic Destruction.Auto Add Drop Failed", false, "Drop items that did not fit into the inventory"),
AUTOMATIC_DESTRUCTION_CLEANUP_DELAY_TIME("Automatic Destruction.Cleanup Delay Seconds", 20, "Seconds to wait before (force) removing remnants of the tree"),
AUTOMATIC_DESTRUCTION_CLEANUP_LEAVES("Automatic Destruction.Cleanup Leaves", true, "If we clean up remnants, we also will remove leaves without drops"),
AUTOMATIC_DESTRUCTION_COOLDOWN("Automatic Destruction.Cooldown Seconds", 0, "Time to wait before allowing the player to automatically destroy again"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ enum PreciseAdding {
AUTOMATIC_DESTRUCTION_CLEANUP_LEAVES(7.3018f, "default", TreeConfig.CFG.AUTOMATIC_DESTRUCTION_CLEANUP_LEAVES.getNode(), true, new int[] {1, 16, 0}),
TRUNK_GREEDY(7.3025f, "default", TreeConfig.CFG.TRUNK_GREEDY.getNode(), false, new int[] {1, 16, 0}),
AUTOMATIC_DESTRUCTION_AUTO_ADD_ONLY_LOGS_TO_INVENTORY(7.3037f, "default", TreeConfig.CFG.AUTOMATIC_DESTRUCTION_AUTO_ADD_ONLY_LOGS_TO_INVENTORY.getNode(), false, new int[] {1, 16, 0}),
DEFAULT_MAXIMUM_HEIGHT(7.3041f, "default", TreeConfig.CFG.TRUNK_MAXIMUM_HEIGHT.getNode(), -1, new int[] {1, 16, 0})
DEFAULT_MAXIMUM_HEIGHT(7.3041f, "default", TreeConfig.CFG.TRUNK_MAXIMUM_HEIGHT.getNode(), -1, new int[] {1, 16, 0}),

AUTOMATIC_DESTRUCTION_AUTO_ADD_DROP_FAILED(7.3055f, "default", TreeConfig.CFG.AUTOMATIC_DESTRUCTION_AUTO_ADD_DROP_FAILED.getNode(), false, new int[] {1, 13, 0})
;

private final float version;
Expand Down
5 changes: 4 additions & 1 deletion src/main/resources/trees/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ Automatic Destruction:
# Add the tree drops to the player's inventory
Auto Add To Inventory: false

# Drop items that did not fit into the inventory
Auto Add Drop Failed: false

# Only add the logs to the player's inventory
Auto Add Only Logs To Inventory: true

Expand Down Expand Up @@ -287,4 +290,4 @@ Trunk:
Uneven Bottom: false

# Version number for automagical config updates
Version: 7.3044
Version: 7.3056

0 comments on commit a360cce

Please sign in to comment.