aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/ftbsc/bscv/commands/ItemCommand.java (renamed from src/main/java/ftbsc/bscv/commands/Item.java)18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/main/java/ftbsc/bscv/commands/Item.java b/src/main/java/ftbsc/bscv/commands/ItemCommand.java
index 2d4bd7f..e1e1b80 100644
--- a/src/main/java/ftbsc/bscv/commands/Item.java
+++ b/src/main/java/ftbsc/bscv/commands/ItemCommand.java
@@ -1,6 +1,7 @@
package ftbsc.bscv.commands;
import com.google.auto.service.AutoService;
+import com.mojang.brigadier.arguments.IntegerArgumentType;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import ftbsc.bscv.api.ILoadable;
@@ -8,11 +9,15 @@ import ftbsc.bscv.tools.Inventory;
import net.minecraft.command.CommandSource;
import net.minecraft.command.Commands;
import net.minecraft.inventory.container.Slot;
+import net.minecraft.item.Item;
import static ftbsc.bscv.Boscovicino.log;
@AutoService(ILoadable.class)
-public class Item extends AbstractCommand {
+public class ItemCommand extends AbstractCommand {
+
+ @Override
+ public String getName() { return "item"; }
public LiteralArgumentBuilder<CommandSource> register(LiteralArgumentBuilder<CommandSource> builder) {
return builder
@@ -32,6 +37,17 @@ public class Item extends AbstractCommand {
return 1;
})
)
+ .then(
+ Commands.literal("search")
+ .then(
+ Commands.argument("id", IntegerArgumentType.integer(0))
+ .executes(ctx -> {
+ int item_id = ctx.getArgument("id", Integer.class);
+ log("item #[%d] >> %s", item_id, Item.byId(item_id).toString());
+ return 1;
+ })
+ )
+ )
.executes(ctx -> {
Slot slot = Inventory.hotbar(MC.player).get(MC.player.inventory.selected);
if (!slot.hasItem()) return 0;