-
Notifications
You must be signed in to change notification settings - Fork 0
Java‐Driven‐SlowTools
Java-driven SlowTools are dedicated registered items intended for mod developers.
The SlowTool class extends Minecraft's Item class and receives its progressive-crafting behavior from a SlowToolConfig.
You'll need to register SlowTools in your ModItems.class, along with a custom register method.
Register the item under your own mod's namespace, like below:
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: External mods should not use SlowItems.register. That helper currently creates item keys in the slowcraft namespace. Use your own registry helper, as demonstrated above.
| Method | Required | Description |
|---|---|---|
.itemOutput(Item) |
Yes | Adds one output item |
.itemOutput(Item, int) |
Yes | Adds an output with an explicit count |
.useTime(int) |
Yes | Sets the duration in seconds |
.usageSound(SoundEvent) |
No | Changes the periodic crafting sound |
.finishSound(SoundEvent) |
No | Changes the completion sound |
.excludeFromJEI() |
No | Excludes the item from JEI |
.addToCreative() |
No | Adds the item to Slowcraft's creative tab |
A SlowTool requires:
- At least one output
- No more than four outputs
- A use time greater than zero
SlowTool.config()
.itemOutput(Items.IRON_INGOT)
.useTime(30)This creates a 30-second SlowTool that produces one iron ingot.
SlowTool.config()
.itemOutput(Items.IRON_INGOT, 8)
.itemOutput(Items.STICK, 2)
.itemOutput(Items.DIAMOND)
.useTime(30)SlowTool.config()
.itemOutput(Items.WHITE_WOOL)
.useTime(30)
.usageSound(SoundEvents.UI_LOOM_SELECT_PATTERN)
.finishSound(SoundEvents.FIRECHARGE_USE)The default sounds are:
| Event | Default |
|---|---|
| Usage | SoundEvents.BRUSH_GENERIC |
| Completion | SoundEvents.BUBBLE_POP |
Java-driven SlowTools are not added to Slowcraft's creative tab automatically.
Add one with:
.addToCreative()Omit this when your mod already adds the item to another creative tab.
Java-driven SlowTools appear in JEI by default.
To hide one:
.excludeFromJEI()This has no effect when JEI is not installed.
Because this is a normal registered item, your mod must also provide its normal item resources:
- Item model or client item definition
- Item texture
- Translation entry
- Any custom sound definitions
Do not manually place minecraft:damage or minecraft:max_damage components in the item's recipe. Slowcraft initializes its progress state from the registered SlowTool configuration.