diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/ftbsc/bscv/commands/Item.java | 43 |
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; + }); + } + +} |