-
Notifications
You must be signed in to change notification settings - Fork 0
Java‐Driven‐SlowTools
Java-driven SlowTools are normal registered items built with Slowcraft's SlowTool class.
This route is intended for mod developers who want their own registered item, custom assets, custom sounds, or additional Java behavior.
Add the SlowTool to your ModItems class along with a registration helper.
public static final SlowTool STRING_WEAVING = registerSlowTool(
"string_weaving",
SlowTool.config()
.itemOutput(Items.WHITE_WOOL)
.itemOutput(Items.STICK, 2)
.useTime(30)
.addToCreative()
);
private static SlowTool registerSlowTool(
String path,
SlowTool.SlowToolConfig config
) {
ResourceKey<Item> key = ResourceKey.create(
Registries.ITEM,
Identifier.fromNamespaceAndPath(MOD_ID, path)
);
SlowTool item = new SlowTool(
config,
new Item.Properties()
.stacksTo(1)
.setId(key)
);
return Registry.register(
BuiltInRegistries.ITEM,
key,
item
);
}Replace MOD_ID with your mod's namespace.
Important: Don't use Slowcraft's SlowItems.register method from another mod. It registers items in the slowcraft namespace rather than your own. Use a registration helper belonging to your mod, like the one above.
| Method | Required | What it does |
|---|---|---|
.itemOutput(Item) |
Yes | Adds one output item |
.itemOutput(Item, int) |
Yes | Adds an output with a specific amount |
.useTime(int) |
Yes | Sets the crafting time in seconds |
.usageSound(SoundEvent) |
No | Changes the sound played while crafting |
.finishSound(SoundEvent) |
No | Changes the sound played when crafting finishes |
.excludeFromJEI() |
No | Hides the item from JEI |
.addToCreative() |
No | Adds the item to Slowcraft's creative tab |
Every SlowTool needs:
- At least one output
- No more than four outputs
- A use time greater than zero
SlowTool.config()
.itemOutput(Items.IRON_INGOT)
.useTime(30)This takes 30 seconds to complete and gives the player one iron ingot.
You can add up to four output stacks:
SlowTool.config()
.itemOutput(Items.IRON_INGOT, 8)
.itemOutput(Items.STICK, 2)
.itemOutput(Items.DIAMOND)
.itemOutput(Items.STRING)
.useTime(30)If you leave out the amount, Slowcraft gives one of that item.
SlowTool.config()
.itemOutput(Items.WHITE_WOOL)
.useTime(30)
.usageSound(SoundEvents.UI_LOOM_SELECT_PATTERN)
.finishSound(SoundEvents.FIRECHARGE_USE)If you don't provide sounds, Slowcraft uses:
| Event | Default |
|---|---|
| While crafting | SoundEvents.BRUSH_GENERIC |
| When finished | SoundEvents.BUBBLE_POP |
Java-driven SlowTools aren't added to Slowcraft's creative tab by default.
To add one:
.addToCreative()You can leave this out if your mod already adds the item to another creative tab.
Java-driven SlowTools appear in JEI automatically.
To hide one:
.excludeFromJEI()This setting does nothing if JEI isn't installed.
Since a Java-driven SlowTool is a normal registered item, it needs the same resources as any other item:
- An item model or client item definition
- A texture
- A translation entry
- Definitions for any custom sounds you use
Important: Don't add minecraft:damage or minecraft:max_damage to the recipe result. Slowcraft sets up the item's progress bar from its Java configuration.