feat: added item command
mostly for debugging autotool...
This commit is contained in:
parent
414fbf4962
commit
8813dda003
1 changed files with 43 additions and 0 deletions
43
src/main/java/ftbsc/bscv/commands/Item.java
Normal file
43
src/main/java/ftbsc/bscv/commands/Item.java
Normal file
|
@ -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;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue