Skip to content

Commit 980285b

Browse files
committed
- forge fixes #3
1 parent 9962391 commit 980285b

File tree

5 files changed

+30
-26
lines changed

5 files changed

+30
-26
lines changed

common/src/main/java/smartin/armory/GenerateArmorModularConverter.java renamed to common/src/main/java/smartin/miapi/armory/GenerateArmorModularConverter.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
package smartin.armory;
1+
package smartin.miapi.armory;
22

33
import dev.architectury.event.EventResult;
4-
import net.minecraft.item.*;
4+
import net.minecraft.item.ArmorItem;
5+
import net.minecraft.item.ArmorMaterial;
6+
import net.minecraft.item.Item;
7+
import net.minecraft.item.ItemStack;
58
import net.minecraft.registry.Registries;
69
import smartin.miapi.datapack.ReloadEvents;
710
import smartin.miapi.events.MiapiEvents;
@@ -14,10 +17,10 @@
1417
import java.util.*;
1518

1619
public class GenerateArmorModularConverter {
17-
public static Map<Item, Converter> modularItem = new HashMap();
18-
public static Map<ArmorMaterial, List<ArmorItem>> armorItems = new HashMap<>();
20+
public Map<Item, Converter> modularItem = new HashMap<>();
21+
public Map<ArmorMaterial, List<ArmorItem>> armorItems = new HashMap<>();
1922

20-
public static void setup() {
23+
public GenerateArmorModularConverter() {
2124
ReloadEvents.START.subscribe(isClient -> {
2225
modularItem.clear();
2326
armorItems.clear();
@@ -57,7 +60,7 @@ interface Converter {
5760
ItemStack convert(ItemStack raw);
5861
}
5962

60-
protected static void addHelmetItem(Material material, Item item) {
63+
protected void addHelmetItem(Material material, Item item) {
6164
modularItem.put(item, (stack) -> {
6265
ItemStack modularItem = new ItemStack(RegistryInventory.modularItem);
6366
String swordData = "{\n" +
@@ -79,7 +82,7 @@ protected static void addHelmetItem(Material material, Item item) {
7982
});
8083
}
8184

82-
protected static void addChestPlateItem(Material material, Item item) {
85+
protected void addChestPlateItem(Material material, Item item) {
8386
modularItem.put(item, (stack) -> {
8487
ItemStack modularItem = new ItemStack(RegistryInventory.modularItem);
8588
String swordData = "{\n" +
@@ -116,7 +119,7 @@ protected static void addChestPlateItem(Material material, Item item) {
116119
});
117120
}
118121

119-
protected static void addLeggingsItem(Material material, Item item) {
122+
protected void addLeggingsItem(Material material, Item item) {
120123
modularItem.put(item, (stack) -> {
121124
ItemStack modularItem = new ItemStack(RegistryInventory.modularItem);
122125
String swordData = "{\n" +
@@ -153,7 +156,7 @@ protected static void addLeggingsItem(Material material, Item item) {
153156
});
154157
}
155158

156-
protected static void addShoesItem(Material material, Item item) {
159+
protected void addShoesItem(Material material, Item item) {
157160
modularItem.put(item, (stack) -> {
158161
ItemStack modularItem = new ItemStack(RegistryInventory.modularItem);
159162
String swordData = "{\n" +

common/src/main/java/smartin/arsenal/GenerateModularConverters.java renamed to common/src/main/java/smartin/miapi/arsenal/GenerateModularConverters.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package smartin.arsenal;
1+
package smartin.miapi.arsenal;
22

33
import dev.architectury.event.EventResult;
44
import net.minecraft.item.*;
@@ -16,9 +16,9 @@
1616
import java.util.Optional;
1717

1818
public class GenerateModularConverters {
19-
public static Map<Item, Converter> modularItem = new HashMap();
19+
public Map<Item, Converter> modularItem = new HashMap();
2020

21-
public static void setup() {
21+
public GenerateModularConverters() {
2222
ReloadEvents.START.subscribe(isClient -> {
2323
modularItem.clear();
2424
});
@@ -47,7 +47,7 @@ interface Converter{
4747
ItemStack convert(ItemStack raw);
4848
}
4949

50-
protected static void addSwordItem(Material material, Item item) {
50+
protected void addSwordItem(Material material, Item item) {
5151
modularItem.put(item,(stack)->{
5252
ItemStack modularItem = new ItemStack(RegistryInventory.modularItem);
5353
String swordData = new StringBuilder()
@@ -89,7 +89,7 @@ protected static void addSwordItem(Material material, Item item) {
8989
});
9090
}
9191

92-
protected static void addAxeItem(Material material, Item item) {
92+
protected void addAxeItem(Material material, Item item) {
9393
modularItem.put(item,(stack)->{
9494
ItemStack modularItem = new ItemStack(RegistryInventory.modularItem);
9595
String swordData = "{\n" +
@@ -123,7 +123,7 @@ protected static void addAxeItem(Material material, Item item) {
123123
});
124124
}
125125

126-
protected static void addPickAxeItem(Material material, Item item) {
126+
protected void addPickAxeItem(Material material, Item item) {
127127
modularItem.put(item,(stack)->{
128128
ItemStack modularItem = new ItemStack(RegistryInventory.modularItem);
129129
String swordData = "{\n" +
@@ -157,7 +157,7 @@ protected static void addPickAxeItem(Material material, Item item) {
157157
});
158158
}
159159

160-
protected static void addShovelItem(Material material, Item item) {
160+
protected void addShovelItem(Material material, Item item) {
161161
modularItem.put(item,(stack)->{
162162
ItemStack modularItem = new ItemStack(RegistryInventory.modularItem);
163163
String swordData = "{\n" +
@@ -183,7 +183,7 @@ protected static void addShovelItem(Material material, Item item) {
183183
});
184184
}
185185

186-
protected static void addHoeItem(Material material, Item item) {
186+
protected void addHoeItem(Material material, Item item) {
187187
modularItem.put(item,(stack)->{
188188
ItemStack modularItem = new ItemStack(RegistryInventory.modularItem);
189189
String swordData = "{\n" +

common/src/main/java/smartin/miapi/registries/RegistryInventory.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
import net.minecraft.util.Util;
4444
import net.minecraft.world.event.GameEvent;
4545
import org.joml.Matrix4f;
46-
import smartin.armory.GenerateArmorModularConverter;
47-
import smartin.arsenal.GenerateModularConverters;
46+
import smartin.miapi.armory.GenerateArmorModularConverter;
47+
import smartin.miapi.arsenal.GenerateModularConverters;
4848
import smartin.miapi.attributes.AttributeRegistry;
4949
import smartin.miapi.blocks.ModularWorkBench;
5050
import smartin.miapi.blocks.ModularWorkBenchEntity;
@@ -237,7 +237,11 @@ public static void setup() {
237237
});
238238
}));
239239
//ITEM
240-
register(modularItems, "modular_item", ExampleModularItem::new, i -> modularItem = i);
240+
register(modularItems, "modular_item", ExampleModularItem::new, i -> {
241+
modularItem = i;
242+
new GenerateArmorModularConverter();
243+
new GenerateModularConverters();
244+
});
241245
register(modularItems, "modular_handle", ModularWeapon::new);
242246
register(modularItems, "modular_sword", ModularWeapon::new);
243247
register(modularItems, "modular_katana", ModularWeapon::new);
@@ -339,10 +343,9 @@ public static void setup() {
339343
register(gameEvents, "request_crafting_stat_update", () -> new GameEvent(MOD_ID + ":crafting_stat_update", 16), ev -> statUpdateEvent = ev);
340344
register(gameEvents, "stat_provider_updated", () -> new GameEvent(MOD_ID + ":stat_provider_updated", 16), ev -> statProviderUpdatedEvent = ev);
341345

346+
342347
LifecycleEvent.SETUP.register(() -> {
343348
//EDITPROPERTIES
344-
GenerateModularConverters.setup();
345-
GenerateArmorModularConverter.setup();
346349

347350
registerMiapi(editOptions, "replace", new ReplaceOption());
348351
registerMiapi(editOptions, "dev", new PropertyInjectionDev());

forge/build.gradle

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ dependencies {
3434
//forgeRuntimeLibrary(include("dev.kosmx.player-anim:player-animation-lib-forge:0.4.2"
3535
//modApi include("curse.maven:bettercombat-639842:4357578")
3636

37-
//modApi(include("com.github.RedPxnda.Nucleus:nucleus-forge:${rootProject.nucleus_version}"))
38-
39-
modApi(include(files('libs/nucleus.jar')))
37+
modApi(include("com.github.RedPxnda.Nucleus:nucleus-forge:${rootProject.nucleus_version}"))
4038

4139
//forgeRuntimeLibrary("top.theillusivec4.caelus:caelus-forge:${rootProject.caelus_forge_version}")
4240
modApi("top.theillusivec4.caelus:caelus-forge:${rootProject.caelus_forge_version}")

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ fabric_reach_range_version=2.4.0
1818
forge_version=1.20.1-47.0.19
1919
caelus_forge_version=3.1.0+1.20
2020

21-
nucleus_version=30bdbb62e1
21+
nucleus_version=fb8dd1f0fc
2222

2323
mathparser_version=4.4.2

0 commit comments

Comments
 (0)