[Feature] Added Smithing Template for Netherite Fire Bowls
This commit is contained in:
parent
3b2d8529e2
commit
e5bc16320c
2 changed files with 101 additions and 0 deletions
|
@ -0,0 +1,84 @@
|
||||||
|
package org.betterx.bclib.recipes;
|
||||||
|
|
||||||
|
import net.minecraft.ChatFormatting;
|
||||||
|
import net.minecraft.Util;
|
||||||
|
import net.minecraft.network.chat.Component;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.item.SmithingTemplateItem;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class SmithingTemplates {
|
||||||
|
public static final ChatFormatting TITLE_FORMAT = ChatFormatting.GRAY;
|
||||||
|
public static final ChatFormatting DESCRIPTION_FORMAT = ChatFormatting.BLUE;
|
||||||
|
|
||||||
|
public static final ResourceLocation EMPTY_SLOT_INGOT = new ResourceLocation("item/empty_slot_ingot");
|
||||||
|
|
||||||
|
public static Builder create(ResourceLocation id) {
|
||||||
|
return new Builder(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
private final ResourceLocation ID;
|
||||||
|
List<ResourceLocation> baseSlotEmptyIcons;
|
||||||
|
List<ResourceLocation> additionalSlotEmptyIcons;
|
||||||
|
|
||||||
|
protected Builder(ResourceLocation id) {
|
||||||
|
ID = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setBaseSlotEmptyIcons(List<ResourceLocation> baseSlotEmptyIcons) {
|
||||||
|
this.baseSlotEmptyIcons = baseSlotEmptyIcons;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setAdditionalSlotEmptyIcons(List<ResourceLocation> additionalSlotEmptyIcons) {
|
||||||
|
this.additionalSlotEmptyIcons = additionalSlotEmptyIcons;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SmithingTemplateItem build() {
|
||||||
|
if (baseSlotEmptyIcons == null || baseSlotEmptyIcons.isEmpty()) {
|
||||||
|
throw new IllegalStateException("Base slot empty icons must contain at least one icon");
|
||||||
|
}
|
||||||
|
if (additionalSlotEmptyIcons == null || additionalSlotEmptyIcons.isEmpty()) {
|
||||||
|
throw new IllegalStateException("Additional slot empty icons must contain at least one icon");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return new SmithingTemplateItem(
|
||||||
|
Component.translatable(Util.makeDescriptionId(
|
||||||
|
"item",
|
||||||
|
new ResourceLocation(ID.getNamespace(), "smithing_template." + ID.getPath() + ".applies_to")
|
||||||
|
)).withStyle(DESCRIPTION_FORMAT),
|
||||||
|
Component.translatable(Util.makeDescriptionId(
|
||||||
|
"item",
|
||||||
|
new ResourceLocation(
|
||||||
|
ID.getNamespace(),
|
||||||
|
"smithing_template." + ID.getPath() + ".ingredients"
|
||||||
|
)
|
||||||
|
)).withStyle(DESCRIPTION_FORMAT),
|
||||||
|
Component.translatable(Util.makeDescriptionId(
|
||||||
|
"upgrade",
|
||||||
|
ID
|
||||||
|
)).withStyle(TITLE_FORMAT),
|
||||||
|
Component.translatable(Util.makeDescriptionId(
|
||||||
|
"item",
|
||||||
|
new ResourceLocation(
|
||||||
|
ID.getNamespace(),
|
||||||
|
"smithing_template." + ID.getPath() + ".base_slot_description"
|
||||||
|
)
|
||||||
|
)),
|
||||||
|
Component.translatable(Util.makeDescriptionId(
|
||||||
|
"item",
|
||||||
|
new ResourceLocation(
|
||||||
|
ID.getNamespace(),
|
||||||
|
"smithing_template." + ID.getPath() + ".additions_slot_description"
|
||||||
|
)
|
||||||
|
)),
|
||||||
|
baseSlotEmptyIcons,
|
||||||
|
additionalSlotEmptyIcons
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,6 +10,7 @@ import org.betterx.bclib.items.tool.BaseHoeItem;
|
||||||
import org.betterx.bclib.items.tool.BasePickaxeItem;
|
import org.betterx.bclib.items.tool.BasePickaxeItem;
|
||||||
import org.betterx.bclib.items.tool.BaseShearsItem;
|
import org.betterx.bclib.items.tool.BaseShearsItem;
|
||||||
import org.betterx.bclib.models.RecordItemModelProvider;
|
import org.betterx.bclib.models.RecordItemModelProvider;
|
||||||
|
import org.betterx.bclib.recipes.SmithingTemplates;
|
||||||
import org.betterx.worlds.together.tag.v3.CommonItemTags;
|
import org.betterx.worlds.together.tag.v3.CommonItemTags;
|
||||||
import org.betterx.worlds.together.tag.v3.TagManager;
|
import org.betterx.worlds.together.tag.v3.TagManager;
|
||||||
import org.betterx.worlds.together.tag.v3.ToolTags;
|
import org.betterx.worlds.together.tag.v3.ToolTags;
|
||||||
|
@ -30,6 +31,8 @@ import net.minecraft.world.food.FoodProperties;
|
||||||
import net.minecraft.world.item.*;
|
import net.minecraft.world.item.*;
|
||||||
import net.minecraft.world.level.block.DispenserBlock;
|
import net.minecraft.world.level.block.DispenserBlock;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class ItemRegistry extends BaseRegistry<Item> {
|
public class ItemRegistry extends BaseRegistry<Item> {
|
||||||
public ItemRegistry(PathConfig config) {
|
public ItemRegistry(PathConfig config) {
|
||||||
super(config);
|
super(config);
|
||||||
|
@ -47,6 +50,20 @@ public class ItemRegistry extends BaseRegistry<Item> {
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SmithingTemplateItem registerSmithingTemplateItem(
|
||||||
|
ResourceLocation id,
|
||||||
|
List<ResourceLocation> baseSlotEmptyIcons,
|
||||||
|
List<ResourceLocation> additionalSlotEmptyIcons
|
||||||
|
) {
|
||||||
|
final SmithingTemplateItem item = SmithingTemplates
|
||||||
|
.create(id)
|
||||||
|
.setBaseSlotEmptyIcons(baseSlotEmptyIcons)
|
||||||
|
.setAdditionalSlotEmptyIcons(additionalSlotEmptyIcons)
|
||||||
|
.build();
|
||||||
|
register(new ResourceLocation(id.getNamespace(), id.getPath() + "_smithing_template"), item);
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
public Item register(ResourceLocation itemId) {
|
public Item register(ResourceLocation itemId) {
|
||||||
return register(itemId, new ModelProviderItem(makeItemSettings()));
|
return register(itemId, new ModelProviderItem(makeItemSettings()));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue