diff --git a/src/main/java/techreborn/Core.java b/src/main/java/techreborn/Core.java index fe4ae0ee2..c42619da1 100644 --- a/src/main/java/techreborn/Core.java +++ b/src/main/java/techreborn/Core.java @@ -61,6 +61,7 @@ public class Core { public static TechRebornWorldGen worldGen; public static File configDir; public VersionChecker versionChecker; + public Core() { //Forge says to call it here, so yeah FluidRegistry.enableUniversalBucket(); @@ -84,11 +85,6 @@ public class Core { TechRebornAPI.subItemRetriever = new SubItemRetriever(); //Recheck here because things break at times - CompatManager.isIC2Loaded = Loader.isModLoaded("IC2"); - - for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) { - compatModule.preInit(event); - } // Register ModBlocks ModBlocks.init(); @@ -99,6 +95,12 @@ public class Core { // Entitys EntityRegistry.registerModEntity(new ResourceLocation("techreborn", "nuke"), EntityNukePrimed.class, "nuke", 0, INSTANCE, 160, 5, true); + CompatManager.isIC2Loaded = Loader.isModLoaded("IC2"); + + for (ICompatModule compatModule : CompatManager.INSTANCE.compatModules) { + compatModule.preInit(event); + } + //Ore Dictionary OreDict.init(); proxy.preInit(event); diff --git a/src/main/java/techreborn/client/RegisterItemJsons.java b/src/main/java/techreborn/client/RegisterItemJsons.java index 85f15ad49..df485b624 100644 --- a/src/main/java/techreborn/client/RegisterItemJsons.java +++ b/src/main/java/techreborn/client/RegisterItemJsons.java @@ -5,11 +5,16 @@ import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.ModelLoader; +import net.minecraftforge.fml.common.Loader; import techreborn.blocks.BlockOre; import techreborn.blocks.BlockOre2; +import techreborn.blocks.BlockStorage; +import techreborn.blocks.BlockStorage2; import techreborn.init.ModBlocks; import techreborn.init.ModItems; import techreborn.items.*; +import techreborn.parts.TechRebornParts; +import techreborn.parts.powerCables.EnumCableType; public class RegisterItemJsons { public static void registerModels() { @@ -44,37 +49,37 @@ public class RegisterItemJsons { for (int i = 0; i < ItemIngots.types.length; ++i) { String[] name = ItemIngots.types.clone(); - registerBlockstate(ModItems.ingots, i, name[i]); + registerBlockstate(ModItems.ingots, i, name[i], "items/materials/"); } for (int i = 0; i < ItemGems.types.length; ++i) { String[] name = ItemGems.types.clone(); - registerBlockstate(ModItems.gems, i, name[i]); + registerBlockstate(ModItems.gems, i, name[i], "items/materials/"); } for (int i = 0; i < ItemPlates.types.length; ++i) { String[] name = ItemPlates.types.clone(); - registerBlockstate(ModItems.plate, i, name[i]); + registerBlockstate(ModItems.plate, i, name[i], "items/materials/"); } for (int i = 0; i < ItemNuggets.types.length; ++i) { String[] name = ItemNuggets.types.clone(); - registerBlockstate(ModItems.nuggets, i, name[i]); + registerBlockstate(ModItems.nuggets, i, name[i], "items/materials/"); } for (int i = 0; i < ItemDusts.types.length; ++i) { String[] name = ItemDusts.types.clone(); - registerBlockstate(ModItems.dusts, i, name[i]); + registerBlockstate(ModItems.dusts, i, name[i], "items/materials/"); } for (int i = 0; i < ItemDustsSmall.types.length; ++i) { String[] name = ItemDustsSmall.types.clone(); - registerBlockstate(ModItems.smallDusts, i, name[i]); + registerBlockstate(ModItems.smallDusts, i, name[i], "items/materials/"); } for (int i = 0; i < ItemUpgrades.types.length; ++i) { String[] name = ItemUpgrades.types.clone(); - registerBlockstate(ModItems.upgrades, i, name[i]); + registerBlockstate(ModItems.upgrades, i, name[i], "items/misc/"); } for (int i = 0; i < BlockOre.ores.length; ++i) { @@ -86,6 +91,22 @@ public class RegisterItemJsons { String[] name = BlockOre2.ores.clone(); registerBlockstate(ModBlocks.ore2, i, name[i]); } + + for (int i = 0; i < BlockStorage.types.length; ++i) { + String[] name = BlockStorage.types.clone(); + registerBlockstate(ModBlocks.storage, i, name[i]); + } + + for (int i = 0; i < BlockStorage2.types.length; ++i) { + String[] name = BlockStorage2.types.clone(); + registerBlockstate(ModBlocks.storage2, i, name[i]); + } + + if (Loader.isModLoaded("reborncore-mcmultipart")) + for (EnumCableType i : EnumCableType.values()) { + String name = i.getName(); + registerBlockstate(TechRebornParts.cables, i.ordinal(), name, "items/misc/"); + } } private static void registerBlocks() { @@ -110,12 +131,19 @@ public class RegisterItemJsons { } private static void registerBlockstate(Item i, int meta, String variant) { - ResourceLocation loc = i.getRegistryName(); + registerBlockstate(i, meta, variant, ""); + } + + private static void registerBlockstate(Item i, int meta, String variant, String dir) { + ResourceLocation loc = new ResourceLocation("techreborn", dir + i.getRegistryName().getResourcePath()); ModelLoader.setCustomModelResourceLocation(i, meta, new ModelResourceLocation(loc, "type=" + variant)); } private static void registerBlockstate(Block i, int meta, String variant) { - ResourceLocation loc = i.getRegistryName(); - ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(i), meta, new ModelResourceLocation(loc, "type=" + variant)); + registerBlockstate(i, meta, variant, ""); + } + + private static void registerBlockstate(Block i, int meta, String variant, String dir) { + registerBlockstate(Item.getItemFromBlock(i), meta, variant, dir); } } diff --git a/src/main/java/techreborn/parts/TechRebornParts.java b/src/main/java/techreborn/parts/TechRebornParts.java index 1003de4d8..25ef32378 100644 --- a/src/main/java/techreborn/parts/TechRebornParts.java +++ b/src/main/java/techreborn/parts/TechRebornParts.java @@ -31,11 +31,6 @@ public class TechRebornParts implements ICompatModule { @Override public void preInit(FMLPreInitializationEvent event) { - MinecraftForge.EVENT_BUS.register(this); - } - - @Override - public void init(FMLInitializationEvent event) { for (EnumCableType cableType : EnumCableType.values()) { multipartHashMap.put(cableType, cableType.cableClass); MultipartRegistry.registerPart(cableType.cableClass, "techreborn:cable." + cableType.name()); @@ -43,6 +38,11 @@ public class TechRebornParts implements ICompatModule { cables = new ItemCables(); cables.setRegistryName("cables"); GameRegistry.register(cables); + MinecraftForge.EVENT_BUS.register(this); + } + + @Override + public void init(FMLInitializationEvent event) { // MultipartRegistry.registerPart(EmptyFluidPipe.class, "techreborn:fluidpipe.empty"); // MultipartRegistry.registerPart(InsertingFluidPipe.class, "techreborn:fluidpipe.inserting"); diff --git a/src/main/resources/assets/techreborn/blockstates/dust.json b/src/main/resources/assets/techreborn/blockstates/items/materials/dust.json similarity index 100% rename from src/main/resources/assets/techreborn/blockstates/dust.json rename to src/main/resources/assets/techreborn/blockstates/items/materials/dust.json diff --git a/src/main/resources/assets/techreborn/blockstates/gem.json b/src/main/resources/assets/techreborn/blockstates/items/materials/gem.json similarity index 100% rename from src/main/resources/assets/techreborn/blockstates/gem.json rename to src/main/resources/assets/techreborn/blockstates/items/materials/gem.json diff --git a/src/main/resources/assets/techreborn/blockstates/ingot.json b/src/main/resources/assets/techreborn/blockstates/items/materials/ingot.json similarity index 100% rename from src/main/resources/assets/techreborn/blockstates/ingot.json rename to src/main/resources/assets/techreborn/blockstates/items/materials/ingot.json diff --git a/src/main/resources/assets/techreborn/blockstates/nuggets.json b/src/main/resources/assets/techreborn/blockstates/items/materials/nuggets.json similarity index 100% rename from src/main/resources/assets/techreborn/blockstates/nuggets.json rename to src/main/resources/assets/techreborn/blockstates/items/materials/nuggets.json diff --git a/src/main/resources/assets/techreborn/blockstates/plates.json b/src/main/resources/assets/techreborn/blockstates/items/materials/plates.json similarity index 100% rename from src/main/resources/assets/techreborn/blockstates/plates.json rename to src/main/resources/assets/techreborn/blockstates/items/materials/plates.json diff --git a/src/main/resources/assets/techreborn/blockstates/smalldust.json b/src/main/resources/assets/techreborn/blockstates/items/materials/smalldust.json similarity index 100% rename from src/main/resources/assets/techreborn/blockstates/smalldust.json rename to src/main/resources/assets/techreborn/blockstates/items/materials/smalldust.json diff --git a/src/main/resources/assets/techreborn/blockstates/items/misc/cables.json b/src/main/resources/assets/techreborn/blockstates/items/misc/cables.json new file mode 100644 index 000000000..81a80dc69 --- /dev/null +++ b/src/main/resources/assets/techreborn/blockstates/items/misc/cables.json @@ -0,0 +1,51 @@ +{ + "forge_marker": 1, + "defaults": { + "model": "builtin/generated", + "transform": "forge:default-item" + }, + "variants": { + "type": { + "copper": { + "textures": { + "layer0": "techreborn:items/cables/copper" + } + }, + "glassfiber": { + "textures": { + "layer0": "techreborn:items/cables/glassfiber" + } + }, + "gold": { + "textures": { + "layer0": "techreborn:items/cables/gold" + } + }, + "hv": { + "textures": { + "layer0": "techreborn:items/cables/hv" + } + }, + "insulatedcopper": { + "textures": { + "layer0": "techreborn:items/cables/insulatedcopper" + } + }, + "insulatedgold": { + "textures": { + "layer0": "techreborn:items/cables/insulatedgold" + } + }, + "insulatedhv": { + "textures": { + "layer0": "techreborn:items/cables/insulatedhv" + } + }, + "tin": { + "textures": { + "layer0": "techreborn:items/cables/tin" + } + } + } + } +} \ No newline at end of file diff --git a/src/main/resources/assets/techreborn/blockstates/upgrades.json b/src/main/resources/assets/techreborn/blockstates/items/misc/upgrades.json similarity index 100% rename from src/main/resources/assets/techreborn/blockstates/upgrades.json rename to src/main/resources/assets/techreborn/blockstates/items/misc/upgrades.json diff --git a/src/main/resources/assets/techreborn/blockstates/storage/ores.json b/src/main/resources/assets/techreborn/blockstates/storage/ores.json deleted file mode 100644 index 483123f43..000000000 --- a/src/main/resources/assets/techreborn/blockstates/storage/ores.json +++ /dev/null @@ -1,95 +0,0 @@ -{ - "forge_marker": 1, - "defaults": { - "textures": {}, - "transform": "forge:default-block", - "model": "cube_all" - }, - "variants": { - "inventory": [ - {} - ], - "type": { - "galena": { - "textures": { - "all": "techreborn:blocks/ore/oreGalena" - } - }, - "iridium": { - "textures": { - "all": "techreborn:blocks/ore/oreIridium" - } - }, - "ruby": { - "textures": { - "all": "techreborn:blocks/ore/oreRuby" - } - }, - "sapphire": { - "textures": { - "all": "techreborn:blocks/ore/oreSapphire" - } - }, - "bauxite": { - "textures": { - "all": "techreborn:blocks/ore/oreBauxite" - } - }, - "pyrite": { - "textures": { - "all": "techreborn:blocks/ore/orePyrite" - } - }, - "cinnabar": { - "textures": { - "all": "techreborn:blocks/ore/oreCinnabar" - } - }, - "sphalerite": { - "textures": { - "all": "techreborn:blocks/ore/oreSphalerite" - } - }, - "tungston": { - "textures": { - "all": "techreborn:blocks/ore/oreTungston" - } - }, - "sheldonite": { - "textures": { - "all": "techreborn:blocks/ore/oreSheldonite" - } - }, - "peridot": { - "textures": { - "all": "techreborn:blocks/ore/orePeridot" - } - }, - "sodalite": { - "textures": { - "all": "techreborn:blocks/ore/oreSodalite" - } - }, - "lead": { - "textures": { - "all": "techreborn:blocks/ore/oreLead" - } - }, - "silver": { - "textures": { - "all": "techreborn:blocks/ore/oreSilver" - } - }, - "copper": { - "textures": { - "all": "techreborn:blocks/ore/oreCopper" - } - }, - "tin": { - "textures": { - "all": "techreborn:blocks/ore/oreTin" - } - } - } - } -} diff --git a/src/main/resources/assets/techreborn/blockstates/storage/storage.json b/src/main/resources/assets/techreborn/blockstates/techreborn.storage.json similarity index 56% rename from src/main/resources/assets/techreborn/blockstates/storage/storage.json rename to src/main/resources/assets/techreborn/blockstates/techreborn.storage.json index bed0c172c..84ca0e7a8 100644 --- a/src/main/resources/assets/techreborn/blockstates/storage/storage.json +++ b/src/main/resources/assets/techreborn/blockstates/techreborn.storage.json @@ -20,6 +20,11 @@ "all": "techreborn:blocks/storage/aluminum_block" } }, + "iridium": { + "textures": { + "all": "techreborn:blocks/storage/iridium_block" + } + }, "titanium": { "textures": { "all": "techreborn:blocks/storage/titanium_block" @@ -74,66 +79,6 @@ "textures": { "all": "techreborn:blocks/storage/invar_block" } - }, - "iridium": { - "textures": { - "all": "techreborn:blocks/storage/iridium_block" - } - }, - "tungstensteel": { - "textures": { - "all": "techreborn:blocks/storage/tungstensteel_block" - } - }, - "iridium_reinforced_tungstensteel": { - "textures": { - "all": "techreborn:blocks/storage/iridium_reinforced_tungstensteel_block" - } - }, - "iridium_reinforced_stone": { - "textures": { - "all": "techreborn:blocks/storage/iridium_reinforced_stone_block" - } - }, - "ruby": { - "textures": { - "all": "techreborn:blocks/storage/ruby_block" - } - }, - "sapphire": { - "textures": { - "all": "techreborn:blocks/storage/sapphire_block" - } - }, - "peridot": { - "textures": { - "all": "techreborn:blocks/storage/peridot_block" - } - }, - "yellowGarnet": { - "textures": { - "all": "techreborn:blocks/storage/yellowGarnet_block" - } - }, - "redGarnet": { - "textures": { - "all": "techreborn:blocks/storage/redGarnet_block" - } - }, - "copper": { - "textures": { - "all": "techreborn:blocks/storage/copper_block" - } - }, - "tin": { - "textures": { - "all": "techreborn:blocks/storage/tin_block" - } - }, - "refinedIron": { - "textures": { - "all": "techreborn:blocks/storage/refinedIron_block" - } } } } diff --git a/src/main/resources/assets/techreborn/blockstates/techreborn.storage2.json b/src/main/resources/assets/techreborn/blockstates/techreborn.storage2.json new file mode 100644 index 000000000..5ceee68e1 --- /dev/null +++ b/src/main/resources/assets/techreborn/blockstates/techreborn.storage2.json @@ -0,0 +1,70 @@ +{ + "forge_marker": 1, + "defaults": { + "textures": {}, + "transform": "forge:default-block", + "model": "cube_all" + }, + "variants": { + "inventory": [ + {} + ], + "type": { + "tungstensteel": { + "textures": { + "all": "techreborn:blocks/storage/tungstensteel_block" + } + }, + "iridium_reinforced_tungstensteel": { + "textures": { + "all": "techreborn:blocks/storage/iridium_reinforced_tungstensteel_block" + } + }, + "iridium_reinforced_stone": { + "textures": { + "all": "techreborn:blocks/storage/iridium_reinforced_stone_block" + } + }, + "ruby": { + "textures": { + "all": "techreborn:blocks/storage/ruby_block" + } + }, + "sapphire": { + "textures": { + "all": "techreborn:blocks/storage/sapphire_block" + } + }, + "peridot": { + "textures": { + "all": "techreborn:blocks/storage/peridot_block" + } + }, + "yellowgarnet": { + "textures": { + "all": "techreborn:blocks/storage/yellowgarnet_block" + } + }, + "redgarnet": { + "textures": { + "all": "techreborn:blocks/storage/redgarnet_block" + } + }, + "copper": { + "textures": { + "all": "techreborn:blocks/storage/copper_block" + } + }, + "tin": { + "textures": { + "all": "techreborn:blocks/storage/tin_block" + } + }, + "refinediron": { + "textures": { + "all": "techreborn:blocks/storage/refinediron_block" + } + } + } + } +}