add logs stripped

This commit is contained in:
hyperdefined
2026-04-05 20:18:43 -04:00
parent a785e331b3
commit 6a13c7fef7
11 changed files with 301 additions and 9 deletions

View File

@@ -306,6 +306,35 @@ public class ItemChecker {
return null;
}
/**
* Get the player's axe.
*
* @param inventory Their inventory.
* @return Their axe, either main or offhand.
*/
public @Nullable ItemStack getAxe(PlayerInventory inventory) {
ItemStack main = inventory.getItemInMainHand();
ItemStack offHand = inventory.getItemInOffHand();
boolean isMain = main.getType().toString().endsWith("_AXE");
boolean isOffHand = offHand.getType().toString().endsWith("_AXE");
// if the player is holding an axe in their main hand, use that one
// if the axe is in their offhand instead, use that one after checking main hand
// Minecraft prioritizes main hand if the player holds in both hands
if (isMain && isOffHand) {
return main;
}
if (isMain) {
return main;
}
if (isOffHand) {
return offHand;
}
return null;
}
/**
* Checks the keys of the item and returns the tokens we should add.
* If the server swaps token systems this should allow compatability.
@@ -363,6 +392,9 @@ public class ItemChecker {
if (container.has(toolStats.toolStatsKeys.getTridentThrows())) {
tokens.add("trident-throws");
}
if (container.has(toolStats.toolStatsKeys.getLogsStripped())) {
tokens.add("logs-stripped");
}
if (tokens.isEmpty()) {
return null;
}