diff --git a/common/src/main/java/muramasa/antimatter/data/AntimatterDefaultTools.java b/common/src/main/java/muramasa/antimatter/data/AntimatterDefaultTools.java index 96c56799b..df04f4ef7 100644 --- a/common/src/main/java/muramasa/antimatter/data/AntimatterDefaultTools.java +++ b/common/src/main/java/muramasa/antimatter/data/AntimatterDefaultTools.java @@ -24,30 +24,30 @@ import static net.minecraft.world.level.material.Material.*; public class AntimatterDefaultTools { - public static final AntimatterToolType SWORD = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.ID, "sword", 2, 1, 10, 3.0F, -2.4F, false)).setToolClass(MaterialSword.class).addEffectiveBlocks(Blocks.COBWEB).setHasContainer(false).setMaterialTypeItem(SWORD_BLADE); - public static final AntimatterToolType PICKAXE = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.ID, "pickaxe", 1, 2, 10, 1.0F, -2.8F, true)).addEffectiveMaterials(ICE_SOLID, PISTON).setHasContainer(false).setMaterialTypeItem(PICKAXE_HEAD); - public static final AntimatterToolType SHOVEL = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.ID, "shovel", 1, 2, 10, 1.5F, -3.0F, true)).addEffectiveMaterials(CLAY, SAND, TOP_SNOW, SNOW, DIRT).setHasContainer(false).setMaterialTypeItem(SHOVEL_HEAD); - public static final AntimatterToolType AXE = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.ID, "axe", 1, 1, 10, 6.0F, -3.0F, true)).addEffectiveMaterials(PLANT, REPLACEABLE_PLANT, BAMBOO).setHasContainer(false).setMaterialTypeItem(AXE_HEAD); - public static final AntimatterToolType HOE = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.ID, "hoe", 1, 2, 10, -2.0F, -1.0F, true)).setHasContainer(false).setMaterialTypeItem(HOE_HEAD); - public static final AntimatterToolType HAMMER = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.ID, "hammer", 1, 2, 2, 3.0F, -3.0F, false)).addTags("pickaxe").addEffectiveMaterials(net.minecraft.world.level.material.Material.METAL, STONE).setUseSound(SoundEvents.ANVIL_PLACE).setRepairable(false).setMaterialTypeItem(HAMMER_HEAD); - public static final AntimatterToolType WRENCH = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.ID, "wrench", 1, 2, 2, 1.5F, -2.8F, false)).setUseSound(Ref.WRENCH).addEffectiveBlocks(Blocks.HOPPER).setHasSecondary(false).setOverlayLayers(0).setRepairable(false).addBlacklistedEnchantments(Enchantments.BLOCK_EFFICIENCY); - public static final AntimatterToolType WRENCH_ALT = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.ID, "wrench_alt", 1, 2, 2, 1.5F, -2.8F, false)).setUseSound(Ref.WRENCH).addEffectiveBlocks(Blocks.HOPPER).addTags("wrench").setHasSecondary(false).setOverlayLayers(0).setRepairable(false).addBlacklistedEnchantments(Enchantments.BLOCK_EFFICIENCY).setCustomName("Wrench (Alt)"); - public static final AntimatterToolType SAW = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.ID, "saw", 1, 2, 2, 2.0F, -2.8F, false)).addEffectiveBlocks(Blocks.ICE, Blocks.PACKED_ICE, Blocks.BLUE_ICE).setRepairable(false).setMaterialTypeItem(SAW_BLADE).addTags("axe"); - public static final AntimatterToolType FILE = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.ID, "file", 1, 2, 2, -2.0F, -2.4F, false)).setRepairable(false).setMaterialTypeItem(FILE_HEAD); - public static final AntimatterToolType CROWBAR = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.ID, "crowbar", 1, 10, 5, 1.0F, -2.0F, false)).setUseSound(SoundEvents.ITEM_BREAK).setHasSecondary(false).setRepairable(false); - public static final AntimatterToolType SOFT_HAMMER = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.ID, "soft_hammer", 1, 2, 2, 1.0F, -3.0F, false)).setRepairable(false).setPrimaryRequirement(MaterialTags.RUBBERTOOLS);//.setUseSound(); - public static final AntimatterToolType SCREWDRIVER = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.ID, "screwdriver", 1, 2, 2, 0.0F, -1.0F, false)).setUseSound(Ref.WRENCH).setRepairable(false).setMaterialTypeItem(SCREWDRIVER_TIP); - public static final AntimatterToolType MORTAR = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.ID, "mortar", 1, 5, 2, -2.0F, 0.0F, false)).setUseSound(SoundEvents.GRINDSTONE_USE).setBlockBreakability(false).setRepairable(false); - public static final AntimatterToolType WIRE_CUTTER = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.ID, "wire_cutter", 1, 3, 2, 0.0F, -1.5F, false)).setUseSound(Ref.WIRE_CUTTERS).addEffectiveMaterials(WOOL, SPONGE, WEB, CLOTH_DECORATION).setRepairable(false).addBlacklistedEnchantments(Enchantments.BLOCK_EFFICIENCY); - public static final AntimatterToolType BRANCH_CUTTER = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.ID, "branch_cutter", 1, 3, 2, 0.0F, -1.5F, false)).addTags("grafter").addEffectiveMaterials(LEAVES).setHasContainer(false).setDurabilityMultiplier(0.25f); - public static final AntimatterToolType KNIFE = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.ID, "knife", 1, 2, 1, 2.1F, -2.0F, false)).addEffectiveBlocks(Blocks.COBWEB).setRepairable(false).setTag(new ResourceLocation(Ref.ID, "knives")).setOriginalTag(true); - public static final AntimatterToolType SCISSORS = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.ID, "scissors", 1, 2, 2, 1.0f, -1.5f, false)); - public static final AntimatterToolType PLUNGER = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.ID, "plunger", 5, 5, 10, 0.0F, -2.9F, false)).setUseSound(SoundEvents.BUCKET_EMPTY).setHasSecondary(false).setRepairable(false); - public static final AntimatterToolType SCYTHE = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.ID, "scythe", 1, 2, 5, 6.5f, -3.1f, false)).setMaterialTypeItem(SCYTHE_BLADE); - public static final AntimatterArmorType HELMET = new AntimatterArmorType(Ref.ID, "helmet", 40, 0, 0.0F, 0.0F, EquipmentSlot.HEAD); - public static final AntimatterArmorType CHESTPLATE = new AntimatterArmorType(Ref.ID, "chestplate", 40, 0, 0.0F, 0.0F, EquipmentSlot.CHEST); - public static final AntimatterArmorType LEGGINGS = new AntimatterArmorType(Ref.ID, "leggings", 40, 0, 0.0F, 0.0F, EquipmentSlot.LEGS); - public static final AntimatterArmorType BOOTS = new AntimatterArmorType(Ref.ID, "boots", 40, 0, 0.0F, 0.0F, EquipmentSlot.FEET); + public static final AntimatterToolType SWORD = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.SHARED_ID, "sword", 2, 1, 10, 3.0F, -2.4F, false)).setToolClass(MaterialSword.class).addEffectiveBlocks(Blocks.COBWEB).setHasContainer(false).setMaterialTypeItem(SWORD_BLADE); + public static final AntimatterToolType PICKAXE = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.SHARED_ID, "pickaxe", 1, 2, 10, 1.0F, -2.8F, true)).addEffectiveMaterials(ICE_SOLID, PISTON).setHasContainer(false).setMaterialTypeItem(PICKAXE_HEAD); + public static final AntimatterToolType SHOVEL = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.SHARED_ID, "shovel", 1, 2, 10, 1.5F, -3.0F, true)).addEffectiveMaterials(CLAY, SAND, TOP_SNOW, SNOW, DIRT).setHasContainer(false).setMaterialTypeItem(SHOVEL_HEAD); + public static final AntimatterToolType AXE = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.SHARED_ID, "axe", 1, 1, 10, 6.0F, -3.0F, true)).addEffectiveMaterials(PLANT, REPLACEABLE_PLANT, BAMBOO).setHasContainer(false).setMaterialTypeItem(AXE_HEAD); + public static final AntimatterToolType HOE = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.SHARED_ID, "hoe", 1, 2, 10, -2.0F, -1.0F, true)).setHasContainer(false).setMaterialTypeItem(HOE_HEAD); + public static final AntimatterToolType HAMMER = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.SHARED_ID, "hammer", 1, 2, 2, 3.0F, -3.0F, false)).addTags("pickaxe").addEffectiveMaterials(net.minecraft.world.level.material.Material.METAL, STONE).setUseSound(SoundEvents.ANVIL_PLACE).setRepairable(false).setMaterialTypeItem(HAMMER_HEAD); + public static final AntimatterToolType WRENCH = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.SHARED_ID, "wrench", 1, 2, 2, 1.5F, -2.8F, false)).setUseSound(Ref.WRENCH).addEffectiveBlocks(Blocks.HOPPER).setHasSecondary(false).setOverlayLayers(0).setRepairable(false).addBlacklistedEnchantments(Enchantments.BLOCK_EFFICIENCY); + public static final AntimatterToolType WRENCH_ALT = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.SHARED_ID, "wrench_alt", 1, 2, 2, 1.5F, -2.8F, false)).setUseSound(Ref.WRENCH).addEffectiveBlocks(Blocks.HOPPER).addTags("wrench").setHasSecondary(false).setOverlayLayers(0).setRepairable(false).addBlacklistedEnchantments(Enchantments.BLOCK_EFFICIENCY).setCustomName("Wrench (Alt)"); + public static final AntimatterToolType SAW = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.SHARED_ID, "saw", 1, 2, 2, 2.0F, -2.8F, false)).addEffectiveBlocks(Blocks.ICE, Blocks.PACKED_ICE, Blocks.BLUE_ICE).setRepairable(false).setMaterialTypeItem(SAW_BLADE).addTags("axe"); + public static final AntimatterToolType FILE = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.SHARED_ID, "file", 1, 2, 2, -2.0F, -2.4F, false)).setRepairable(false).setMaterialTypeItem(FILE_HEAD); + public static final AntimatterToolType CROWBAR = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.SHARED_ID, "crowbar", 1, 10, 5, 1.0F, -2.0F, false)).setUseSound(SoundEvents.ITEM_BREAK).setHasSecondary(false).setRepairable(false); + public static final AntimatterToolType SOFT_HAMMER = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.SHARED_ID, "soft_hammer", 1, 2, 2, 1.0F, -3.0F, false)).setRepairable(false).setPrimaryRequirement(MaterialTags.RUBBERTOOLS);//.setUseSound(); + public static final AntimatterToolType SCREWDRIVER = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.SHARED_ID, "screwdriver", 1, 2, 2, 0.0F, -1.0F, false)).setUseSound(Ref.WRENCH).setRepairable(false).setMaterialTypeItem(SCREWDRIVER_TIP); + public static final AntimatterToolType MORTAR = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.SHARED_ID, "mortar", 1, 5, 2, -2.0F, 0.0F, false)).setUseSound(SoundEvents.GRINDSTONE_USE).setBlockBreakability(false).setRepairable(false); + public static final AntimatterToolType WIRE_CUTTER = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.SHARED_ID, "wire_cutter", 1, 3, 2, 0.0F, -1.5F, false)).setUseSound(Ref.WIRE_CUTTERS).addEffectiveMaterials(WOOL, SPONGE, WEB, CLOTH_DECORATION).setRepairable(false).addBlacklistedEnchantments(Enchantments.BLOCK_EFFICIENCY); + public static final AntimatterToolType BRANCH_CUTTER = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.SHARED_ID, "branch_cutter", 1, 3, 2, 0.0F, -1.5F, false)).addTags("grafter").addEffectiveMaterials(LEAVES).setHasContainer(false).setDurabilityMultiplier(0.25f); + public static final AntimatterToolType KNIFE = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.SHARED_ID, "knife", 1, 2, 1, 2.1F, -2.0F, false)).addEffectiveBlocks(Blocks.COBWEB).setRepairable(false).setTag(new ResourceLocation(Ref.ID, "knives")).setOriginalTag(true); + public static final AntimatterToolType SCISSORS = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.SHARED_ID, "scissors", 1, 2, 2, 1.0f, -1.5f, false)); + public static final AntimatterToolType PLUNGER = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.SHARED_ID, "plunger", 5, 5, 10, 0.0F, -2.9F, false)).setUseSound(SoundEvents.BUCKET_EMPTY).setHasSecondary(false).setRepairable(false); + public static final AntimatterToolType SCYTHE = AntimatterAPI.register(AntimatterToolType.class, new AntimatterToolType(Ref.SHARED_ID, "scythe", 1, 2, 5, 6.5f, -3.1f, false)).setMaterialTypeItem(SCYTHE_BLADE); + public static final AntimatterArmorType HELMET = new AntimatterArmorType(Ref.SHARED_ID, "helmet", 40, 0, 0.0F, 0.0F, EquipmentSlot.HEAD); + public static final AntimatterArmorType CHESTPLATE = new AntimatterArmorType(Ref.SHARED_ID, "chestplate", 40, 0, 0.0F, 0.0F, EquipmentSlot.CHEST); + public static final AntimatterArmorType LEGGINGS = new AntimatterArmorType(Ref.SHARED_ID, "leggings", 40, 0, 0.0F, 0.0F, EquipmentSlot.LEGS); + public static final AntimatterArmorType BOOTS = new AntimatterArmorType(Ref.SHARED_ID, "boots", 40, 0, 0.0F, 0.0F, EquipmentSlot.FEET); public static void init(Side side){ AXE.addBehaviour(BehaviourLogStripping.INSTANCE, BehaviourTreeFelling.INSTANCE); diff --git a/common/src/main/java/muramasa/antimatter/recipe/RecipeBuilders.java b/common/src/main/java/muramasa/antimatter/recipe/RecipeBuilders.java index 7f6da720f..5a11fd75b 100644 --- a/common/src/main/java/muramasa/antimatter/recipe/RecipeBuilders.java +++ b/common/src/main/java/muramasa/antimatter/recipe/RecipeBuilders.java @@ -52,7 +52,7 @@ public Map getFromResult(@NotNull ItemStack stack) { @Override public ItemStack build(CraftingContainer inv, MaterialRecipe.Result mats) { int dye = ((DyeColor) mats.mats.get("secondary")).getMaterialColor().col; - IAntimatterTool type = AntimatterAPI.get(IAntimatterTool.class, id); + IAntimatterTool type = AntimatterAPI.get(IAntimatterTool.class, id, Ref.SHARED_ID); ItemStack stack = type.asItemStack(type.getAntimatterItemTier().getPrimary(), NULL); stack.getOrCreateTagElement(Ref.TAG_TOOL_DATA).putInt(Ref.KEY_TOOL_DATA_SECONDARY_COLOUR, dye); return stack; diff --git a/common/src/main/java/muramasa/antimatter/recipe/ingredient/PropertyIngredient.java b/common/src/main/java/muramasa/antimatter/recipe/ingredient/PropertyIngredient.java index 848f2fb6b..8c7148a27 100644 --- a/common/src/main/java/muramasa/antimatter/recipe/ingredient/PropertyIngredient.java +++ b/common/src/main/java/muramasa/antimatter/recipe/ingredient/PropertyIngredient.java @@ -166,7 +166,7 @@ public JsonElement toJson() { if (optionalTools.size() > 0) { JsonObject map = new JsonObject(); for (Object2BooleanMap.Entry entry : optionalTools.object2BooleanEntrySet()) { - map.addProperty(entry.getKey().getId(), entry.getBooleanValue()); + map.addProperty(entry.getKey().getLoc().toString(), entry.getBooleanValue()); } obj.add("tools", map); } @@ -241,7 +241,7 @@ public PropertyIngredient parse(FriendlyByteBuf buffer) { size = buffer.readVarInt(); Object2BooleanMap map = new Object2BooleanOpenHashMap<>(size); for (int i = 0; i < size; i++) { - map.put(AntimatterAPI.get(AntimatterToolType.class, buffer.readUtf()), buffer.readBoolean()); + map.put(AntimatterAPI.get(AntimatterToolType.class, buffer.readUtf(), buffer.readUtf()), buffer.readBoolean()); } size = buffer.readVarInt(); Set fixedMats = new ObjectArraySet<>(size); @@ -288,7 +288,8 @@ public PropertyIngredient parse(JsonObject json) { Object2BooleanMap map = new Object2BooleanOpenHashMap<>(); if (json.has("tools")) { for (Map.Entry entry : GsonHelper.getAsJsonObject(json, "tools").entrySet()) { - map.put(AntimatterAPI.get(AntimatterToolType.class, entry.getKey()), entry.getValue().getAsBoolean()); + ResourceLocation location = new ResourceLocation(entry.getKey()); + map.put(AntimatterAPI.get(AntimatterToolType.class, location.getPath(), location.getNamespace()), entry.getValue().getAsBoolean()); } } Set fixedMats = Collections.emptySet(); @@ -317,6 +318,7 @@ public void write(FriendlyByteBuf buffer, PropertyIngredient ingredient) { buffer.writeVarInt(ingredient.optionalTools.size()); for (Object2BooleanMap.Entry entry : ingredient.optionalTools.object2BooleanEntrySet()) { buffer.writeUtf(entry.getKey().getId()); + buffer.writeUtf(entry.getKey().getDomain()); buffer.writeBoolean(entry.getBooleanValue()); } buffer.writeVarInt(ingredient.fixedMats.size()); diff --git a/common/src/main/java/muramasa/antimatter/tool/AntimatterToolType.java b/common/src/main/java/muramasa/antimatter/tool/AntimatterToolType.java index eefeeb7bc..701709745 100644 --- a/common/src/main/java/muramasa/antimatter/tool/AntimatterToolType.java +++ b/common/src/main/java/muramasa/antimatter/tool/AntimatterToolType.java @@ -15,6 +15,7 @@ import muramasa.antimatter.material.MaterialTags; import muramasa.antimatter.material.MaterialTypeItem; import muramasa.antimatter.material.data.ToolData; +import muramasa.antimatter.registration.IAntimatterObject; import muramasa.antimatter.registration.ISharedAntimatterObject; import muramasa.antimatter.util.AntimatterPlatformUtils; import muramasa.antimatter.util.TagUtils; @@ -38,7 +39,7 @@ import java.util.function.Function; import java.util.function.Supplier; -public class AntimatterToolType implements ISharedAntimatterObject { +public class AntimatterToolType implements IAntimatterObject { private final String domain, id; @Getter @@ -167,6 +168,11 @@ public AntimatterToolType(String domain, String id, AntimatterToolType inheritTy this(domain, id, inheritType.useDurability, inheritType.attackDurability, inheritType.craftingDurability, inheritType.baseAttackDamage, inheritType.baseAttackSpeed, false); } + @Override + public String getDomain() { + return domain; + } + /* IAntimatterTool Instantiations */ /** @@ -371,7 +377,7 @@ public void removeBehaviour(String... ids) { public ItemStack getToolStack(Material primary, Material secondary) { String id = simple ? primary.getId() + "_" + this.id : this.id; - return Objects.requireNonNull(AntimatterAPI.get(IAntimatterTool.class, id)).asItemStack(primary, secondary); + return Objects.requireNonNull(AntimatterAPI.get(IAntimatterTool.class, id, domain)).asItemStack(primary, secondary); } public ItemStack getToolStack(Material primary) { @@ -390,7 +396,7 @@ public ItemStack getToolStack(Material primary) { } } String id = simple ? primary.getId() + "_" + this.id : this.id; - return Objects.requireNonNull(AntimatterAPI.get(IAntimatterTool.class, id)).asItemStack(primary, Material.NULL); + return Objects.requireNonNull(AntimatterAPI.get(IAntimatterTool.class, id, domain)).asItemStack(primary, Material.NULL); } public Item getToolItem(Material material){ @@ -398,7 +404,7 @@ public Item getToolItem(Material material){ return replacements.get(material.getId()).get(); } String id = simple ? material.getId() + "_" + this.id : this.id; - return Objects.requireNonNull(AntimatterAPI.get(IAntimatterTool.class, id)).getItem(); + return Objects.requireNonNull(AntimatterAPI.get(IAntimatterTool.class, id, domain)).getItem(); } @Override diff --git a/common/src/main/java/muramasa/antimatter/tool/IAntimatterArmor.java b/common/src/main/java/muramasa/antimatter/tool/IAntimatterArmor.java index dae50b5ab..2f902f636 100644 --- a/common/src/main/java/muramasa/antimatter/tool/IAntimatterArmor.java +++ b/common/src/main/java/muramasa/antimatter/tool/IAntimatterArmor.java @@ -6,10 +6,7 @@ import muramasa.antimatter.datagen.providers.AntimatterItemModelProvider; import muramasa.antimatter.material.Material; import muramasa.antimatter.material.MaterialTags; -import muramasa.antimatter.registration.IColorHandler; -import muramasa.antimatter.registration.IModelProvider; -import muramasa.antimatter.registration.ISharedAntimatterObject; -import muramasa.antimatter.registration.ITextureProvider; +import muramasa.antimatter.registration.*; import muramasa.antimatter.texture.Texture; import muramasa.antimatter.tool.armor.AntimatterArmorType; import net.minecraft.network.chat.Component; @@ -26,7 +23,7 @@ import java.util.List; import java.util.Map; -public interface IAntimatterArmor extends ISharedAntimatterObject, IColorHandler, ITextureProvider, IModelProvider, IAbstractToolMethods { +public interface IAntimatterArmor extends IAntimatterObject, IColorHandler, ITextureProvider, IModelProvider, IAbstractToolMethods { AntimatterArmorType getAntimatterArmorType(); Material getMat(); diff --git a/common/src/main/java/muramasa/antimatter/tool/IAntimatterTool.java b/common/src/main/java/muramasa/antimatter/tool/IAntimatterTool.java index eb0dfa30f..894e98e1a 100644 --- a/common/src/main/java/muramasa/antimatter/tool/IAntimatterTool.java +++ b/common/src/main/java/muramasa/antimatter/tool/IAntimatterTool.java @@ -12,10 +12,7 @@ import muramasa.antimatter.item.ItemBattery; import muramasa.antimatter.material.Material; import muramasa.antimatter.material.MaterialTags; -import muramasa.antimatter.registration.IColorHandler; -import muramasa.antimatter.registration.IModelProvider; -import muramasa.antimatter.registration.ISharedAntimatterObject; -import muramasa.antimatter.registration.ITextureProvider; +import muramasa.antimatter.registration.*; import muramasa.antimatter.texture.Texture; import muramasa.antimatter.util.Utils; import net.minecraft.ChatFormatting; @@ -55,7 +52,7 @@ import static muramasa.antimatter.material.Material.NULL; -public interface IAntimatterTool extends ISharedAntimatterObject, IBasicAntimatterTool, IEnergyItem, ICustomDurability { +public interface IAntimatterTool extends IAntimatterObject, IBasicAntimatterTool, IEnergyItem, ICustomDurability { AntimatterItemTier getAntimatterItemTier(); diff --git a/common/src/main/java/muramasa/antimatter/tool/MaterialSword.java b/common/src/main/java/muramasa/antimatter/tool/MaterialSword.java index 070260ad6..391a4ab8c 100644 --- a/common/src/main/java/muramasa/antimatter/tool/MaterialSword.java +++ b/common/src/main/java/muramasa/antimatter/tool/MaterialSword.java @@ -83,6 +83,11 @@ public String getId() { return type.isPowered() ? String.join("_", type.getId(), Ref.VN[energyTier].toLowerCase(Locale.ENGLISH)) : type.getId(); } + @Override + public String getDomain() { + return domain; + } + @NotNull @Override public AntimatterToolType getAntimatterToolType() { diff --git a/common/src/main/java/muramasa/antimatter/tool/armor/AntimatterArmorType.java b/common/src/main/java/muramasa/antimatter/tool/armor/AntimatterArmorType.java index 48f453cd9..d0d2c2ca5 100644 --- a/common/src/main/java/muramasa/antimatter/tool/armor/AntimatterArmorType.java +++ b/common/src/main/java/muramasa/antimatter/tool/armor/AntimatterArmorType.java @@ -1,11 +1,13 @@ package muramasa.antimatter.tool.armor; import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import lombok.Getter; import muramasa.antimatter.AntimatterAPI; import muramasa.antimatter.Ref; import muramasa.antimatter.material.IMaterialTag; import muramasa.antimatter.material.Material; import muramasa.antimatter.material.MaterialTags; +import muramasa.antimatter.registration.IAntimatterObject; import muramasa.antimatter.registration.ISharedAntimatterObject; import muramasa.antimatter.tool.IAntimatterArmor; import muramasa.antimatter.util.AntimatterPlatformUtils; @@ -26,15 +28,23 @@ import java.util.Objects; import java.util.function.Supplier; -public class AntimatterArmorType implements ISharedAntimatterObject { +public class AntimatterArmorType implements IAntimatterObject { private final String domain, id; + @Getter private final List tooltip = new ObjectArrayList<>(); + @Getter private final boolean repairable; + @Getter private final int durabilityFactor, extraArmor; + @Getter private final float extraToughness, extraKnockback; + @Getter private final CreativeModeTab itemGroup; + @Getter private EquipmentSlot slot; + @Getter private SoundEvent event; + @Getter int overlayLayers; @Nullable private IMaterialTag materialRequirement; @@ -69,7 +79,7 @@ public AntimatterArmorType(String domain, String id, int durabilityFactor, int e public List instantiateTools() { List armors = new ArrayList<>(); MaterialTags.ARMOR.all().forEach(m -> { - armors.add(new MaterialArmor(Ref.SHARED_ID, this, m, slot, prepareInstantiation(Ref.SHARED_ID))); + armors.add(new MaterialArmor(domain, this, m, slot, prepareInstantiation(domain))); }); return armors; } @@ -115,11 +125,8 @@ public AntimatterArmorType setPrimaryRequirement(IMaterialTag tag) { } public ItemStack getToolStack(Material primary) { - return Objects.requireNonNull(AntimatterAPI.get(IAntimatterArmor.class, primary.getId() + "_" + id)).asItemStack(); - } - - public List getTooltip() { - return tooltip; + IAntimatterArmor armor = AntimatterAPI.get(IAntimatterArmor.class, primary.getId() + "_" + id, domain); + return Objects.requireNonNull(armor).asItemStack(); } @Override @@ -132,39 +139,4 @@ public String getId() { return id; } - public boolean isRepairable() { - return repairable; - } - - public int getOverlayLayers() { - return overlayLayers; - } - - public int getDurabilityFactor() { - return durabilityFactor; - } - - public int getExtraArmor() { - return extraArmor; - } - - public float getExtraToughness() { - return extraToughness; - } - - public float getExtraKnockback() { - return extraKnockback; - } - - public CreativeModeTab getItemGroup() { - return itemGroup; - } - - public EquipmentSlot getSlot() { - return slot; - } - - public SoundEvent getEvent() { - return event; - } } diff --git a/common/src/main/java/muramasa/antimatter/tool/armor/MaterialArmor.java b/common/src/main/java/muramasa/antimatter/tool/armor/MaterialArmor.java index 41fbec493..39ee9aba8 100644 --- a/common/src/main/java/muramasa/antimatter/tool/armor/MaterialArmor.java +++ b/common/src/main/java/muramasa/antimatter/tool/armor/MaterialArmor.java @@ -44,6 +44,11 @@ public String getId() { return material.getId() + "_" + type.getId(); } + @Override + public String getDomain() { + return domain; + } + @Override public AntimatterArmorType getAntimatterArmorType() { return type;