summaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
author alemi <me@alemi.dev>2023-03-04 01:30:59 +0100
committer alemi <me@alemi.dev>2023-03-04 01:30:59 +0100
commit8813dda003cea6286dcfdc94c6c5a22b0cbe8b01 (patch)
treef8317c9cbac9cb74098dfd59247c73d4ef645049 /src/main/java
parent414fbf4962cafd1286c2cc6c0814ae31ce87ef23 (diff)
feat: added item command
mostly for debugging autotool...
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/ftbsc/bscv/commands/Item.java43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/main/java/ftbsc/bscv/commands/Item.java b/src/main/java/ftbsc/bscv/commands/Item.java
new file mode 100644
index 0000000..2d4bd7f
--- /dev/null
+++ b/src/main/java/ftbsc/bscv/commands/Item.java
@@ -0,0 +1,43 @@
+package ftbsc.bscv.commands;
+
+import com.google.auto.service.AutoService;
+import com.mojang.brigadier.builder.LiteralArgumentBuilder;
+
+import ftbsc.bscv.api.ILoadable;
+import ftbsc.bscv.tools.Inventory;
+import net.minecraft.command.CommandSource;
+import net.minecraft.command.Commands;
+import net.minecraft.inventory.container.Slot;
+
+import static ftbsc.bscv.Boscovicino.log;
+
+@AutoService(ILoadable.class)
+public class Item extends AbstractCommand {
+
+ public LiteralArgumentBuilder<CommandSource> register(LiteralArgumentBuilder<CommandSource> builder) {
+ return builder
+ .then(
+ Commands.literal("damage")
+ .executes(ctx -> {
+ Slot slot = Inventory.hotbar(MC.player).get(MC.player.inventory.selected);
+ if (!slot.hasItem()) return 0;
+ log(
+ String.format(
+ "A %.1f | S %.1f | DPS %.2f",
+ Inventory.itemAttackDamage(slot.getItem()),
+ Inventory.itemAttackSpeed(slot.getItem()),
+ Inventory.itemDPS(slot.getItem())
+ )
+ );
+ return 1;
+ })
+ )
+ .executes(ctx -> {
+ Slot slot = Inventory.hotbar(MC.player).get(MC.player.inventory.selected);
+ if (!slot.hasItem()) return 0;
+ log(slot.getItem().toString());
+ return 1;
+ });
+ }
+
+}