diff --git a/src/main/java/techreborn/TechReborn.java b/src/main/java/techreborn/TechReborn.java index c1b3e1a0c..d583121e6 100644 --- a/src/main/java/techreborn/TechReborn.java +++ b/src/main/java/techreborn/TechReborn.java @@ -29,17 +29,14 @@ import net.minecraft.block.BlockDispenser; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; import net.minecraft.util.ResourceLocation; import net.minecraft.world.gen.structure.MapGenStructureIO; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.*; -import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.registry.EntityRegistry; @@ -123,7 +120,6 @@ public class TechReborn { // Registration TRTileEntities.init(); ModFluids.init(); - TRContent.registerItems(); // Entitys EntityRegistry.registerModEntity(new ResourceLocation("techreborn", "nuke"), EntityNukePrimed.class, "nuke", 0, INSTANCE, 160, 5, true); @@ -131,12 +127,6 @@ public class TechReborn { proxy.preInit(event); } - @SubscribeEvent(priority = EventPriority.LOW)//LOW is used as we want it to load as late as possible, but before crafttweaker - public void registerRecipes(RegistryEvent.Register event) { - //Register ModRecipes - ModRecipes.init(); - } - @Mod.EventHandler public void init(FMLInitializationEvent event) { // Registers Chest Loot diff --git a/src/main/java/techreborn/client/RegisterItemJsons.java b/src/main/java/techreborn/client/RegisterItemJsons.java deleted file mode 100644 index 0aa650d94..000000000 --- a/src/main/java/techreborn/client/RegisterItemJsons.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 TechReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package techreborn.client; - -import net.minecraft.block.Block; -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 techreborn.TechReborn; -import techreborn.config.ConfigTechReborn; -import techreborn.init.TRContent; - -public class RegisterItemJsons { - public static void registerModels() { - TRContent.registerModel(); - registerItems(); - registerBlocks(); - } - - private static void registerItems() { - // Armor - register(TRContent.CLOAKING_DEVICE, "armor/cloaking_device"); - register(TRContent.LAPOTRONIC_ORBPACK, "armor/lapotronic_orbpack"); - register(TRContent.LITHIUM_ION_BATPACK, "armor/lithium_batpack"); - - // Battery - register(TRContent.RED_CELL_BATTERY, "battery/re_battery"); - register(TRContent.LITHIUM_ION_BATTERY, "battery/lithium_battery"); - register(TRContent.ENERGY_CRYSTAL, "battery/energy_crystal"); - register(TRContent.LAPOTRON_CRYSTAL, "battery/lapotron_crystal"); - register(TRContent.LAPOTRONIC_ORB, "battery/lapotronic_orb"); - - // Tools - register(TRContent.INDUSTRIAL_CHAINSAW, "tool/industrial_chainsaw"); - register(TRContent.INDUSTRIAL_DRILL, "tool/industrial_drill"); - register(TRContent.INDUSTRIAL_JACKHAMMER, "tool/industrial_jackhammer"); - register(TRContent.DEBUG_TOOL, "tool/debug"); - register(TRContent.ADVANCED_CHAINSAW, "tool/advanced_chainsaw"); - register(TRContent.ADVANCED_DRILL, "tool/advanced_drill"); - register(TRContent.ADVANCED_JACKHAMMER, "tool/advanced_jackhammer"); - register(TRContent.ELECTRIC_TREE_TAP, "tool/electric_treetap"); - register(TRContent.NANOSABER, "tool/nanosaber"); - register(TRContent.OMNI_TOOL, "tool/omni_tool"); - register(TRContent.ROCK_CUTTER, "tool/rock_cutter"); - register(TRContent.BASIC_CHAINSAW, "tool/basic_chainsaw"); - register(TRContent.BASIC_DRILL, "tool/basic_drill"); - register(TRContent.BASIC_JACKHAMMER, "tool/basic_jackhammer"); - register(TRContent.TREE_TAP, "tool/treetap"); - register(TRContent.WRENCH, "tool/wrench"); - - // Other - register(TRContent.FREQUENCY_TRANSMITTER, "misc/frequency_transmitter"); - register(TRContent.SCRAP_BOX, "misc/scrapbox"); - register(TRContent.MANUAL, "misc/manual"); - ; - - // Gem armor & tools - if (ConfigTechReborn.enableGemArmorAndTools) { - registerBlockstateMultiItem(TRContent.RUBY_HELMET, "ruby_helmet", "items/armour"); - registerBlockstateMultiItem(TRContent.RUBY_CHESTPLATE, "ruby_chestplate", "items/armour"); - registerBlockstateMultiItem(TRContent.RUBY_LEGGINGS, "ruby_leggings", "items/armour"); - registerBlockstateMultiItem(TRContent.RUBY_BOOTS, "ruby_boots", "items/armour"); - registerBlockstateMultiItem(TRContent.SAPPHIRE_HELMET, "sapphire_helmet", "items/armour"); - registerBlockstateMultiItem(TRContent.SAPPHIRE_CHESTPLATE, "sapphire_chestplate", "items/armour"); - registerBlockstateMultiItem(TRContent.SAPPHIRE_LEGGINGS, "sapphire_leggings", "items/armour"); - registerBlockstateMultiItem(TRContent.SAPPHIRE_BOOTS, "sapphire_boots", "items/armour"); - registerBlockstateMultiItem(TRContent.PERIDOT_HELMET, "peridot_helmet", "items/armour"); - registerBlockstateMultiItem(TRContent.PERIDOT_CHESTPLATE, "peridot_chestplate", "items/armour"); - registerBlockstateMultiItem(TRContent.PERIDOT_LEGGINGS, "peridot_leggings", "items/armour"); - registerBlockstateMultiItem(TRContent.PERIDOT_BOOTS, "peridot_boots", "items/armour"); - registerBlockstateMultiItem(TRContent.BRONZE_HELMET, "bronze_helmet", "items/armour"); - registerBlockstateMultiItem(TRContent.BRONZE_CHESTPLATE, "bronze_chestplate", "items/armour"); - registerBlockstateMultiItem(TRContent.BRONZE_LEGGINGS, "bronze_leggings", "items/armour"); - registerBlockstateMultiItem(TRContent.BRONZE_BOOTS, "bronze_boots", "items/armour"); - - registerBlockstateMultiItem(TRContent.RUBY_PICKAXE, "ruby_pickaxe", "items/tool"); - registerBlockstateMultiItem(TRContent.RUBY_SWORD, "ruby_sword", "items/tool"); - registerBlockstateMultiItem(TRContent.RUBY_AXE, "ruby_axe", "items/tool"); - registerBlockstateMultiItem(TRContent.RUBY_SPADE, "ruby_spade", "items/tool"); - registerBlockstateMultiItem(TRContent.RUBY_HOE, "ruby_hoe", "items/tool"); - registerBlockstateMultiItem(TRContent.SAPPHIRE_PICKAXE, "sapphire_pickaxe", "items/tool"); - registerBlockstateMultiItem(TRContent.SAPPHIRE_SWORD, "sapphire_sword", "items/tool"); - registerBlockstateMultiItem(TRContent.SAPPHIRE_AXE, "sapphire_axe", "items/tool"); - registerBlockstateMultiItem(TRContent.SAPPHIRE_SPADE, "sapphire_spade", "items/tool"); - registerBlockstateMultiItem(TRContent.SAPPHIRE_HOE, "sapphire_hoe", "items/tool"); - registerBlockstateMultiItem(TRContent.PERIDOT_PICKAXE, "peridot_pickaxe", "items/tool"); - registerBlockstateMultiItem(TRContent.PERIDOT_SWORD, "peridot_sword", "items/tool"); - registerBlockstateMultiItem(TRContent.PERIDOT_AXE, "peridot_axe", "items/tool"); - registerBlockstateMultiItem(TRContent.PERIDOT_SPADE, "peridot_spade", "items/tool"); - registerBlockstateMultiItem(TRContent.PERIDOT_HOE, "peridot_hoe", "items/tool"); - registerBlockstateMultiItem(TRContent.BRONZE_PICKAXE, "bronze_pickaxe", "items/tool"); - registerBlockstateMultiItem(TRContent.BRONZE_SWORD, "bronze_sword", "items/tool"); - registerBlockstateMultiItem(TRContent.BRONZE_AXE, "bronze_axe", "items/tool"); - registerBlockstateMultiItem(TRContent.BRONZE_SPADE, "bronze_spade", "items/tool"); - registerBlockstateMultiItem(TRContent.BRONZE_HOE, "bronze_hoe", "items/tool"); - } - - register(TRContent.RUBBER_SAPLING, "misc/rubber_sapling"); - } - - private static void registerBlocks() { - register(TRContent.REFINED_IRON_FENCE, "iron_fence"); - } - - private static void register(Item item, int meta, String name) { - ResourceLocation loc = new ResourceLocation(TechReborn.MOD_ID, name); - ModelLoader.setCustomModelResourceLocation(item, meta, - new ModelResourceLocation(loc, "inventory")); - } - - private static void register(Item item, String name) { - register(item, 0, name); - } - - private static void register(Block block, int meta, String name) { - register(Item.getItemFromBlock(block), meta, name); - } - - private static void register(Block block, String name) { - register(block, 0, name); - } - - @SuppressWarnings("unused") - private static void registerBlockstate(Item i, int meta, String variant) { - registerBlockstate(i, meta, variant, ""); - } - - private static void registerBlockstate(Item i, int meta, String variant, String dir) { - ResourceLocation loc = new ResourceLocation(TechReborn.MOD_ID, dir + i.getRegistryName().getPath()); - ModelLoader.setCustomModelResourceLocation(i, meta, new ModelResourceLocation(loc, "type=" + variant)); - } - - @SuppressWarnings("unused") - private static void registerBlockstate(Block i, int meta, String variant) { - registerBlockstate(i, meta, variant, ""); - } - - private static void registerBlockstate(Block i, int meta, String variant, String dir) { - registerBlockstate(Item.getItemFromBlock(i), meta, variant, dir); - } - - private static void registerBlockstateMultiItem(Item item, String variantName, String path) { - registerBlockstateMultiItem(item, 0, variantName, path); - } - - private static void registerBlockstateMultiItem(Item item, int meta, String variantName, String path) { - ResourceLocation loc = new ResourceLocation(TechReborn.MOD_ID, path); - ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(loc, "type=" + variantName)); - } -} diff --git a/src/main/java/techreborn/events/FluidBlockModelHandler.java b/src/main/java/techreborn/events/FluidBlockModelHandler.java deleted file mode 100644 index ecbadb544..000000000 --- a/src/main/java/techreborn/events/FluidBlockModelHandler.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * This file is part of TechReborn, licensed under the MIT License (MIT). - * - * Copyright (c) 2018 TechReborn - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package techreborn.events; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.ItemMeshDefinition; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; -import net.minecraft.client.renderer.block.statemap.StateMapperBase; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.event.ModelRegistryEvent; -import net.minecraftforge.client.model.ModelLoader; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -import techreborn.TechReborn; -import techreborn.blocks.fluid.BlockFluidTechReborn; -import techreborn.init.ModFluids; - -/** - * @author drcrazy - * - */ -@SideOnly(Side.CLIENT) -public class FluidBlockModelHandler { - - @SubscribeEvent - public void registerModels(ModelRegistryEvent event) { - registerFluidBlockModel(ModFluids.BLOCK_BERYLLIUM); - registerFluidBlockModel(ModFluids.BLOCK_CALCIUM); - registerFluidBlockModel(ModFluids.BLOCK_CALCIUM_CARBONATE); - registerFluidBlockModel(ModFluids.BLOCK_CHLORITE); - registerFluidBlockModel(ModFluids.BLOCK_DEUTERIUM); - registerFluidBlockModel(ModFluids.BLOCK_GLYCERYL); - registerFluidBlockModel(ModFluids.BLOCK_HELIUM); - registerFluidBlockModel(ModFluids.BLOCK_HELIUM_3); - registerFluidBlockModel(ModFluids.BLOCK_HELIUMPLASMA); - registerFluidBlockModel(ModFluids.BLOCK_HYDROGEN); - registerFluidBlockModel(ModFluids.BLOCK_LITHIUM); - registerFluidBlockModel(ModFluids.BLOCK_MERCURY); - registerFluidBlockModel(ModFluids.BLOCK_METHANE); - registerFluidBlockModel(ModFluids.BLOCK_NITROCOAL_FUEL); - registerFluidBlockModel(ModFluids.BLOCK_NITROFUEL); - registerFluidBlockModel(ModFluids.BLOCK_NITROGEN); - registerFluidBlockModel(ModFluids.BLOCK_NITROGENDIOXIDE); - registerFluidBlockModel(ModFluids.BLOCK_POTASSIUM); - registerFluidBlockModel(ModFluids.BLOCK_SILICON); - registerFluidBlockModel(ModFluids.BLOCK_SODIUM); - registerFluidBlockModel(ModFluids.BLOCK_SODIUMPERSULFATE); - registerFluidBlockModel(ModFluids.BLOCK_TRITIUM); - registerFluidBlockModel(ModFluids.BLOCK_WOLFRAMIUM); - registerFluidBlockModel(ModFluids.BLOCK_CARBON); - registerFluidBlockModel(ModFluids.BLOCK_CARBON_FIBER); - registerFluidBlockModel(ModFluids.BLOCK_NITRO_CARBON); - registerFluidBlockModel(ModFluids.BLOCK_SULFUR); - registerFluidBlockModel(ModFluids.BLOCK_SODIUM_SULFIDE); - registerFluidBlockModel(ModFluids.BLOCK_DIESEL); - registerFluidBlockModel(ModFluids.BLOCK_NITRO_DIESEL); - registerFluidBlockModel(ModFluids.BLOCK_OIL); - registerFluidBlockModel(ModFluids.BLOCK_SULFURIC_ACID); - registerFluidBlockModel(ModFluids.BLOCK_COMPRESSED_AIR); - registerFluidBlockModel(ModFluids.BLOCK_ELECTROLYZED_WATER); - } - - private static void registerFluidBlockModel(BlockFluidTechReborn block) { - String name = block.getTranslationKey().substring(5).toLowerCase(); - Item item = Item.getItemFromBlock(block); - ModelResourceLocation location = new ModelResourceLocation( - new ResourceLocation(TechReborn.MOD_ID.toLowerCase(), "fluids"), name); - - ModelLoader.registerItemVariants(item); - ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition() { - @Override - public ModelResourceLocation getModelLocation(ItemStack stack) { - return location; - } - }); - ModelLoader.setCustomStateMapper(block, new StateMapperBase() { - @Override - protected ModelResourceLocation getModelResourceLocation(IBlockState state) { - return location; - } - }); - } - -} diff --git a/src/main/java/techreborn/events/ModelRegistryEventHandler.java b/src/main/java/techreborn/events/ModelRegistryEventHandler.java new file mode 100644 index 000000000..5522a031b --- /dev/null +++ b/src/main/java/techreborn/events/ModelRegistryEventHandler.java @@ -0,0 +1,331 @@ +/* + * This file is part of TechReborn, licensed under the MIT License (MIT). + * + * Copyright (c) 2018 TechReborn + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package techreborn.events; + +import java.util.Arrays; +import java.util.Map; + +import com.google.common.collect.Maps; + +import net.minecraft.block.Block; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.ItemMeshDefinition; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.client.renderer.block.statemap.DefaultStateMapper; +import net.minecraft.client.renderer.block.statemap.StateMapperBase; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.event.ModelRegistryEvent; +import net.minecraftforge.client.model.ModelLoader; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import reborncore.client.models.RebornModelRegistry; +import techreborn.TechReborn; +import techreborn.blocks.fluid.BlockFluidTechReborn; +import techreborn.client.render.ModelDynamicCell; +import techreborn.config.ConfigTechReborn; +import techreborn.init.ModFluids; +import techreborn.init.TRContent; +import techreborn.init.TRContent.Cables; +import techreborn.init.TRContent.Dusts; +import techreborn.init.TRContent.Gems; +import techreborn.init.TRContent.Ingots; +import techreborn.init.TRContent.MachineBlocks; +import techreborn.init.TRContent.Nuggets; +import techreborn.init.TRContent.Ores; +import techreborn.init.TRContent.Parts; +import techreborn.init.TRContent.Plates; +import techreborn.init.TRContent.SmallDusts; +import techreborn.init.TRContent.StorageBlocks; +import techreborn.init.TRContent.Upgrades; + +/** + * @author drcrazy + * + */ +@SideOnly(Side.CLIENT) +@Mod.EventBusSubscriber(modid = TechReborn.MOD_ID) +public class ModelRegistryEventHandler { + + @SubscribeEvent + public static void registerModels(ModelRegistryEvent event) { + registerBlocks(); + registerFluidBlocks(); + registerItems(); + ModelDynamicCell.init(); + RebornModelRegistry.registerModels(TechReborn.MOD_ID); + } + + private static void registerBlocks() { + register(TRContent.REFINED_IRON_FENCE, "iron_fence"); + register(TRContent.RUBBER_SAPLING, "misc/rubber_sapling"); + + ResourceLocation oresRL = new ResourceLocation(TechReborn.MOD_ID, "ore"); + for (Ores value : Ores.values()) { + ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(value.block), 0, new ModelResourceLocation(oresRL, "type=" + value.name)); + ModelLoader.setCustomStateMapper(value.block, new DefaultStateMapper() { + @Override + protected ModelResourceLocation getModelResourceLocation(IBlockState state) { + return new ModelResourceLocation(oresRL, "type=" + value.name); + } + }); + } + + ResourceLocation storageRL = new ResourceLocation(TechReborn.MOD_ID, "storage_block"); + for (StorageBlocks value : StorageBlocks.values()) { + ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(value.block), 0, new ModelResourceLocation(storageRL, "type=" + value.name)); + ModelLoader.setCustomStateMapper(value.block, new DefaultStateMapper() { + @Override + protected ModelResourceLocation getModelResourceLocation(IBlockState state) { + return new ModelResourceLocation(storageRL, "type=" + value.name); + } + }); + } + + ResourceLocation machineBlockRL = new ResourceLocation(TechReborn.MOD_ID, "machine_block"); + for (MachineBlocks value : MachineBlocks.values()) { + ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(value.frame), 0, new ModelResourceLocation(machineBlockRL, "type=" + value.name + "_machine_frame")); + ModelLoader.setCustomStateMapper(value.frame, new DefaultStateMapper() { + @Override + protected ModelResourceLocation getModelResourceLocation(IBlockState state) { + return new ModelResourceLocation(machineBlockRL, "type=" + value.name + "_machine_frame"); + } + }); + ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(value.casing), 0, new ModelResourceLocation(machineBlockRL, "type=" + value.name + "_machine_casing")); + ModelLoader.setCustomStateMapper(value.casing, new DefaultStateMapper() { + @Override + protected ModelResourceLocation getModelResourceLocation(IBlockState state) { + return new ModelResourceLocation(machineBlockRL, "type=" + value.name + "_machine_casing"); + } + }); + } + + ResourceLocation cableRL = new ResourceLocation(TechReborn.MOD_ID, "cable_inv"); + for (Cables value : Cables.values()) { + ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(value.block), 0, + new ModelResourceLocation(cableRL, "type=" + value.name)); + ModelLoader.setCustomStateMapper(value.block, new DefaultStateMapper() { + @Override + protected ModelResourceLocation getModelResourceLocation(IBlockState state) { + Map, Comparable> map = Maps.newLinkedHashMap(state.getProperties()); + String property = this.getPropertyString(map) + ",ztype=" + value.name; + + return new ModelResourceLocation(new ResourceLocation(TechReborn.MOD_ID, + "cable_" + (value.cableThickness == 5 ? "thick" : "thin")), property); + } + }); + } + } + + private static void registerFluidBlocks() { + registerFluidBlockModel(ModFluids.BLOCK_BERYLLIUM); + registerFluidBlockModel(ModFluids.BLOCK_CALCIUM); + registerFluidBlockModel(ModFluids.BLOCK_CALCIUM_CARBONATE); + registerFluidBlockModel(ModFluids.BLOCK_CHLORITE); + registerFluidBlockModel(ModFluids.BLOCK_DEUTERIUM); + registerFluidBlockModel(ModFluids.BLOCK_GLYCERYL); + registerFluidBlockModel(ModFluids.BLOCK_HELIUM); + registerFluidBlockModel(ModFluids.BLOCK_HELIUM_3); + registerFluidBlockModel(ModFluids.BLOCK_HELIUMPLASMA); + registerFluidBlockModel(ModFluids.BLOCK_HYDROGEN); + registerFluidBlockModel(ModFluids.BLOCK_LITHIUM); + registerFluidBlockModel(ModFluids.BLOCK_MERCURY); + registerFluidBlockModel(ModFluids.BLOCK_METHANE); + registerFluidBlockModel(ModFluids.BLOCK_NITROCOAL_FUEL); + registerFluidBlockModel(ModFluids.BLOCK_NITROFUEL); + registerFluidBlockModel(ModFluids.BLOCK_NITROGEN); + registerFluidBlockModel(ModFluids.BLOCK_NITROGENDIOXIDE); + registerFluidBlockModel(ModFluids.BLOCK_POTASSIUM); + registerFluidBlockModel(ModFluids.BLOCK_SILICON); + registerFluidBlockModel(ModFluids.BLOCK_SODIUM); + registerFluidBlockModel(ModFluids.BLOCK_SODIUMPERSULFATE); + registerFluidBlockModel(ModFluids.BLOCK_TRITIUM); + registerFluidBlockModel(ModFluids.BLOCK_WOLFRAMIUM); + registerFluidBlockModel(ModFluids.BLOCK_CARBON); + registerFluidBlockModel(ModFluids.BLOCK_CARBON_FIBER); + registerFluidBlockModel(ModFluids.BLOCK_NITRO_CARBON); + registerFluidBlockModel(ModFluids.BLOCK_SULFUR); + registerFluidBlockModel(ModFluids.BLOCK_SODIUM_SULFIDE); + registerFluidBlockModel(ModFluids.BLOCK_DIESEL); + registerFluidBlockModel(ModFluids.BLOCK_NITRO_DIESEL); + registerFluidBlockModel(ModFluids.BLOCK_OIL); + registerFluidBlockModel(ModFluids.BLOCK_SULFURIC_ACID); + registerFluidBlockModel(ModFluids.BLOCK_COMPRESSED_AIR); + registerFluidBlockModel(ModFluids.BLOCK_ELECTROLYZED_WATER); + } + + private static void registerItems() { + // Armor + register(TRContent.CLOAKING_DEVICE, "armor/cloaking_device"); + register(TRContent.LAPOTRONIC_ORBPACK, "armor/lapotronic_orbpack"); + register(TRContent.LITHIUM_ION_BATPACK, "armor/lithium_batpack"); + + // Battery + register(TRContent.RED_CELL_BATTERY, "battery/re_battery"); + register(TRContent.LITHIUM_ION_BATTERY, "battery/lithium_battery"); + register(TRContent.ENERGY_CRYSTAL, "battery/energy_crystal"); + register(TRContent.LAPOTRON_CRYSTAL, "battery/lapotron_crystal"); + register(TRContent.LAPOTRONIC_ORB, "battery/lapotronic_orb"); + + // Tools + register(TRContent.INDUSTRIAL_CHAINSAW, "tool/industrial_chainsaw"); + register(TRContent.INDUSTRIAL_DRILL, "tool/industrial_drill"); + register(TRContent.INDUSTRIAL_JACKHAMMER, "tool/industrial_jackhammer"); + register(TRContent.DEBUG_TOOL, "tool/debug"); + register(TRContent.ADVANCED_CHAINSAW, "tool/advanced_chainsaw"); + register(TRContent.ADVANCED_DRILL, "tool/advanced_drill"); + register(TRContent.ADVANCED_JACKHAMMER, "tool/advanced_jackhammer"); + register(TRContent.ELECTRIC_TREE_TAP, "tool/electric_treetap"); + register(TRContent.NANOSABER, "tool/nanosaber"); + register(TRContent.OMNI_TOOL, "tool/omni_tool"); + register(TRContent.ROCK_CUTTER, "tool/rock_cutter"); + register(TRContent.BASIC_CHAINSAW, "tool/basic_chainsaw"); + register(TRContent.BASIC_DRILL, "tool/basic_drill"); + register(TRContent.BASIC_JACKHAMMER, "tool/basic_jackhammer"); + register(TRContent.TREE_TAP, "tool/treetap"); + register(TRContent.WRENCH, "tool/wrench"); + + // Other + register(TRContent.FREQUENCY_TRANSMITTER, "misc/frequency_transmitter"); + register(TRContent.SCRAP_BOX, "misc/scrapbox"); + register(TRContent.MANUAL, "misc/manual"); + + // Gem armor & tools + if (ConfigTechReborn.enableGemArmorAndTools) { + ResourceLocation armourRL = new ResourceLocation(TechReborn.MOD_ID, "items/armour"); + registerBlockstateMultiItem(armourRL, TRContent.RUBY_HELMET, "ruby_helmet"); + registerBlockstateMultiItem(armourRL, TRContent.RUBY_CHESTPLATE, "ruby_chestplate"); + registerBlockstateMultiItem(armourRL, TRContent.RUBY_LEGGINGS, "ruby_leggings"); + registerBlockstateMultiItem(armourRL, TRContent.RUBY_BOOTS, "ruby_boots"); + registerBlockstateMultiItem(armourRL, TRContent.SAPPHIRE_HELMET, "sapphire_helmet"); + registerBlockstateMultiItem(armourRL, TRContent.SAPPHIRE_CHESTPLATE, "sapphire_chestplate"); + registerBlockstateMultiItem(armourRL, TRContent.SAPPHIRE_LEGGINGS, "sapphire_leggings"); + registerBlockstateMultiItem(armourRL, TRContent.SAPPHIRE_BOOTS, "sapphire_boots"); + registerBlockstateMultiItem(armourRL, TRContent.PERIDOT_HELMET, "peridot_helmet"); + registerBlockstateMultiItem(armourRL, TRContent.PERIDOT_CHESTPLATE, "peridot_chestplate"); + registerBlockstateMultiItem(armourRL, TRContent.PERIDOT_LEGGINGS, "peridot_leggings"); + registerBlockstateMultiItem(armourRL, TRContent.PERIDOT_BOOTS, "peridot_boots"); + registerBlockstateMultiItem(armourRL, TRContent.BRONZE_HELMET, "bronze_helmet"); + registerBlockstateMultiItem(armourRL, TRContent.BRONZE_CHESTPLATE, "bronze_chestplate"); + registerBlockstateMultiItem(armourRL, TRContent.BRONZE_LEGGINGS, "bronze_leggings"); + registerBlockstateMultiItem(armourRL, TRContent.BRONZE_BOOTS, "bronze_boots"); + + ResourceLocation toolRL = new ResourceLocation(TechReborn.MOD_ID, "items/tool"); + registerBlockstateMultiItem(toolRL, TRContent.RUBY_PICKAXE, "ruby_pickaxe"); + registerBlockstateMultiItem(toolRL, TRContent.RUBY_SWORD, "ruby_sword"); + registerBlockstateMultiItem(toolRL, TRContent.RUBY_AXE, "ruby_axe"); + registerBlockstateMultiItem(toolRL, TRContent.RUBY_SPADE, "ruby_spade"); + registerBlockstateMultiItem(toolRL, TRContent.RUBY_HOE, "ruby_hoe"); + registerBlockstateMultiItem(toolRL, TRContent.SAPPHIRE_PICKAXE, "sapphire_pickaxe"); + registerBlockstateMultiItem(toolRL, TRContent.SAPPHIRE_SWORD, "sapphire_sword"); + registerBlockstateMultiItem(toolRL, TRContent.SAPPHIRE_AXE, "sapphire_axe"); + registerBlockstateMultiItem(toolRL, TRContent.SAPPHIRE_SPADE, "sapphire_spade"); + registerBlockstateMultiItem(toolRL, TRContent.SAPPHIRE_HOE, "sapphire_hoe"); + registerBlockstateMultiItem(toolRL, TRContent.PERIDOT_PICKAXE, "peridot_pickaxe"); + registerBlockstateMultiItem(toolRL, TRContent.PERIDOT_SWORD, "peridot_sword"); + registerBlockstateMultiItem(toolRL, TRContent.PERIDOT_AXE, "peridot_axe"); + registerBlockstateMultiItem(toolRL, TRContent.PERIDOT_SPADE, "peridot_spade"); + registerBlockstateMultiItem(toolRL, TRContent.PERIDOT_HOE, "peridot_hoe"); + registerBlockstateMultiItem(toolRL, TRContent.BRONZE_PICKAXE, "bronze_pickaxe"); + registerBlockstateMultiItem(toolRL, TRContent.BRONZE_SWORD, "bronze_sword"); + registerBlockstateMultiItem(toolRL, TRContent.BRONZE_AXE, "bronze_axe"); + registerBlockstateMultiItem(toolRL, TRContent.BRONZE_SPADE, "bronze_spade"); + registerBlockstateMultiItem(toolRL, TRContent.BRONZE_HOE, "bronze_hoe"); + } + + ResourceLocation dustsRL = new ResourceLocation(TechReborn.MOD_ID, "items/material/dust"); + Arrays.stream(Dusts.values()).forEach(value -> registerBlockstateMultiItem(dustsRL, value.item, value.name)); + + ResourceLocation dustsSmallRL = new ResourceLocation(TechReborn.MOD_ID, "items/material/small_dust"); + Arrays.stream(SmallDusts.values()).forEach(value -> registerBlockstateMultiItem(dustsSmallRL, value.item, value.name)); + + ResourceLocation gemsRL = new ResourceLocation(TechReborn.MOD_ID, "items/material/gem"); + Arrays.stream(Gems.values()).forEach(value -> registerBlockstateMultiItem(gemsRL, value.item, value.name)); + + ResourceLocation ingotsRL = new ResourceLocation(TechReborn.MOD_ID, "items/material/ingot"); + Arrays.stream(Ingots.values()).forEach(value -> registerBlockstateMultiItem(ingotsRL, value.item, value.name)); + + ResourceLocation nuggetsRL = new ResourceLocation(TechReborn.MOD_ID, "items/material/nugget"); + Arrays.stream(Nuggets.values()).forEach(value -> registerBlockstateMultiItem(nuggetsRL, value.item, value.name)); + + ResourceLocation partsRL = new ResourceLocation(TechReborn.MOD_ID, "items/material/part"); + Arrays.stream(Parts.values()).forEach(value -> registerBlockstateMultiItem(partsRL, value.item, value.name)); + + ResourceLocation platesRL = new ResourceLocation(TechReborn.MOD_ID, "items/material/plate"); + Arrays.stream(Plates.values()).forEach(value -> registerBlockstateMultiItem(platesRL, value.item, value.name)); + + ResourceLocation upgradeRL = new ResourceLocation(TechReborn.MOD_ID, "items/misc/upgrades"); + Arrays.stream(Upgrades.values()).forEach(value -> registerBlockstateMultiItem(upgradeRL, value.item, value.name)); + + } + + private static void registerFluidBlockModel(BlockFluidTechReborn block) { + String name = block.getTranslationKey().substring(5).toLowerCase(); + Item item = Item.getItemFromBlock(block); + ModelResourceLocation location = new ModelResourceLocation( + new ResourceLocation(TechReborn.MOD_ID, "fluids"), name); + + ModelLoader.registerItemVariants(item); + ModelLoader.setCustomMeshDefinition(item, new ItemMeshDefinition() { + @Override + public ModelResourceLocation getModelLocation(ItemStack stack) { + return location; + } + }); + ModelLoader.setCustomStateMapper(block, new StateMapperBase() { + @Override + protected ModelResourceLocation getModelResourceLocation(IBlockState state) { + return location; + } + }); + } + + private static void register(Block block, String name) { + register(block, 0, name); + } + + private static void register(Block block, int meta, String name) { + register(Item.getItemFromBlock(block), meta, name); + } + + private static void register(Item item, String name) { + register(item, 0, name); + } + + private static void register(Item item, int meta, String name) { + ResourceLocation loc = new ResourceLocation(TechReborn.MOD_ID, name); + ModelLoader.setCustomModelResourceLocation(item, meta, + new ModelResourceLocation(loc, "inventory")); + } + + private static void registerBlockstateMultiItem(ResourceLocation RL, Item item, String variantName) { + ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(RL, "type=" + variantName)); + } + +} diff --git a/src/main/java/techreborn/events/RegistryEventHandler.java b/src/main/java/techreborn/events/RegistryEventHandler.java index aa30ba1a3..f7d61781e 100644 --- a/src/main/java/techreborn/events/RegistryEventHandler.java +++ b/src/main/java/techreborn/events/RegistryEventHandler.java @@ -7,12 +7,21 @@ import java.util.Arrays; import net.minecraft.block.Block; import net.minecraft.block.BlockSlab; +import net.minecraft.inventory.EntityEquipmentSlot; +import net.minecraft.item.Item; import net.minecraft.item.ItemSlab; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipe; +import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import reborncore.RebornRegistry; +import reborncore.common.blocks.BlockMachineBase; +import reborncore.common.util.BucketHandler; import techreborn.TechReborn; +import techreborn.api.Reference; import techreborn.blocks.BlockComputerCube; import techreborn.blocks.BlockNuke; import techreborn.blocks.BlockRefinedIronFence; @@ -23,14 +32,57 @@ import techreborn.blocks.BlockRubberPlank; import techreborn.blocks.BlockRubberPlankSlab; import techreborn.blocks.BlockRubberPlankStair; import techreborn.blocks.BlockRubberSapling; +import techreborn.config.ConfigTechReborn; +import techreborn.init.ModRecipes; import techreborn.init.TRContent; import techreborn.init.TRContent.Cables; +import techreborn.init.TRContent.Dusts; +import techreborn.init.TRContent.Gems; +import techreborn.init.TRContent.Ingots; import techreborn.init.TRContent.Machine; import techreborn.init.TRContent.MachineBlocks; +import techreborn.init.TRContent.Nuggets; import techreborn.init.TRContent.Ores; +import techreborn.init.TRContent.Parts; +import techreborn.init.TRContent.Plates; +import techreborn.init.TRContent.SmallDusts; import techreborn.init.TRContent.SolarPanels; import techreborn.init.TRContent.StorageBlocks; +import techreborn.init.TRContent.Upgrades; import techreborn.itemblocks.ItemBlockRubberSapling; +import techreborn.items.DynamicCell; +import techreborn.items.ItemFrequencyTransmitter; +import techreborn.items.ItemManual; +import techreborn.items.ItemScrapBox; +import techreborn.items.armor.ItemCloakingDevice; +import techreborn.items.armor.ItemLapotronicOrbpack; +import techreborn.items.armor.ItemLithiumIonBatpack; +import techreborn.items.armor.ItemTRArmour; +import techreborn.items.battery.ItemEnergyCrystal; +import techreborn.items.battery.ItemLapotronCrystal; +import techreborn.items.battery.ItemLapotronicOrb; +import techreborn.items.battery.ItemLithiumIonBattery; +import techreborn.items.battery.ItemRedCellBattery; +import techreborn.items.tool.ItemDebugTool; +import techreborn.items.tool.ItemTreeTap; +import techreborn.items.tool.ItemWrench; +import techreborn.items.tool.advanced.ItemAdvancedChainsaw; +import techreborn.items.tool.advanced.ItemAdvancedDrill; +import techreborn.items.tool.advanced.ItemAdvancedJackhammer; +import techreborn.items.tool.advanced.ItemRockCutter; +import techreborn.items.tool.basic.ItemBasicChainsaw; +import techreborn.items.tool.basic.ItemBasicDrill; +import techreborn.items.tool.basic.ItemBasicJackhammer; +import techreborn.items.tool.basic.ItemElectricTreetap; +import techreborn.items.tool.industrial.ItemIndustrialChainsaw; +import techreborn.items.tool.industrial.ItemIndustrialDrill; +import techreborn.items.tool.industrial.ItemIndustrialJackhammer; +import techreborn.items.tool.industrial.ItemNanosaber; +import techreborn.items.tool.industrial.ItemOmniTool; +import techreborn.items.tool.vanilla.ItemTRAxe; +import techreborn.items.tool.vanilla.ItemTRHoe; +import techreborn.items.tool.vanilla.ItemTRSpade; +import techreborn.items.tool.vanilla.ItemTRSword; import techreborn.utils.InitUtils; /** @@ -43,7 +95,6 @@ public class RegistryEventHandler { @SubscribeEvent public static void registerBlocks(RegistryEvent.Register event) { - Arrays.stream(Ores.values()).forEach(value -> RebornRegistry.registerBlock(value.block)); Arrays.stream(StorageBlocks.values()).forEach(value -> RebornRegistry.registerBlock(value.block)); Arrays.stream(MachineBlocks.values()).forEach(value -> { @@ -76,5 +127,117 @@ public class RegistryEventHandler { TechReborn.LOGGER.debug("TechReborns Blocks Loaded"); } + + @SubscribeEvent + public static void registerItems(RegistryEvent.Register event) { + Arrays.stream(Ingots.values()).forEach(value -> RebornRegistry.registerItem(value.item)); + Arrays.stream(Nuggets.values()).forEach(value -> RebornRegistry.registerItem(value.item)); + Arrays.stream(Gems.values()).forEach(value -> RebornRegistry.registerItem(value.item)); + Arrays.stream(Dusts.values()).forEach(value -> RebornRegistry.registerItem(value.item)); + Arrays.stream(SmallDusts.values()).forEach(value -> RebornRegistry.registerItem(value.item)); + Arrays.stream(Plates.values()).forEach(value -> RebornRegistry.registerItem(value.item)); + Arrays.stream(Parts.values()).forEach(value -> RebornRegistry.registerItem(value.item)); + Arrays.stream(Upgrades.values()).forEach(value -> RebornRegistry.registerItem(value.item)); + + // Gem armor & tools + if (ConfigTechReborn.enableGemArmorAndTools) { + //Todo: repair with tags + RebornRegistry.registerItem(TRContent.BRONZE_SWORD = InitUtils.setup(new ItemTRSword(Reference.BRONZE, "ingotBronze"), "bronze_sword")); + RebornRegistry.registerItem(TRContent.BRONZE_PICKAXE = InitUtils.setup(new ItemTRSword(Reference.BRONZE, "ingotBronze"), "bronze_pickaxe")); + RebornRegistry.registerItem(TRContent.BRONZE_SPADE = InitUtils.setup(new ItemTRSpade(Reference.BRONZE, "ingotBronze"), "bronze_spade")); + RebornRegistry.registerItem(TRContent.BRONZE_AXE = InitUtils.setup(new ItemTRAxe(Reference.BRONZE, "ingotBronze"), "bronze_axe")); + RebornRegistry.registerItem(TRContent.BRONZE_HOE = InitUtils.setup(new ItemTRHoe(Reference.BRONZE, "ingotBronze"), "bronze_hoe")); + + RebornRegistry.registerItem(TRContent.BRONZE_HELMET = InitUtils.setup(new ItemTRArmour(Reference.BRONZE_ARMOUR, EntityEquipmentSlot.HEAD, "ingotBronze"), "bronze_helmet")); + RebornRegistry.registerItem(TRContent.BRONZE_CHESTPLATE = InitUtils.setup(new ItemTRArmour(Reference.BRONZE_ARMOUR, EntityEquipmentSlot.CHEST, "ingotBronze"), "bronze_chestplate")); + RebornRegistry.registerItem(TRContent.BRONZE_LEGGINGS = InitUtils.setup(new ItemTRArmour(Reference.BRONZE_ARMOUR, EntityEquipmentSlot.LEGS, "ingotBronze"), "bronze_leggings")); + RebornRegistry.registerItem(TRContent.BRONZE_BOOTS = InitUtils.setup(new ItemTRArmour(Reference.BRONZE_ARMOUR, EntityEquipmentSlot.FEET, "ingotBronze"), "bronze_boots")); + + RebornRegistry.registerItem(TRContent.RUBY_SWORD = InitUtils.setup(new ItemTRSword(Reference.RUBY, "gemRuby"), "ruby_sword")); + RebornRegistry.registerItem(TRContent.RUBY_PICKAXE = InitUtils.setup(new ItemTRSword(Reference.RUBY, "gemRuby"), "ruby_pickaxe")); + RebornRegistry.registerItem(TRContent.RUBY_SPADE = InitUtils.setup(new ItemTRSpade(Reference.RUBY, "gemRuby"), "ruby_spade")); + RebornRegistry.registerItem(TRContent.RUBY_AXE = InitUtils.setup(new ItemTRAxe(Reference.RUBY, "gemRuby"), "ruby_axe")); + RebornRegistry.registerItem(TRContent.RUBY_HOE = InitUtils.setup(new ItemTRHoe(Reference.RUBY, "gemRuby"), "ruby_hoe")); + + RebornRegistry.registerItem(TRContent.RUBY_HELMET = InitUtils.setup(new ItemTRArmour(Reference.RUBY_ARMOUR, EntityEquipmentSlot.HEAD, "gemRuby"), "ruby_helmet")); + RebornRegistry.registerItem(TRContent.RUBY_CHESTPLATE = InitUtils.setup(new ItemTRArmour(Reference.RUBY_ARMOUR, EntityEquipmentSlot.CHEST, "gemRuby"), "ruby_chestplate")); + RebornRegistry.registerItem(TRContent.RUBY_LEGGINGS = InitUtils.setup(new ItemTRArmour(Reference.RUBY_ARMOUR, EntityEquipmentSlot.LEGS, "gemRuby"), "ruby_leggings")); + RebornRegistry.registerItem(TRContent.RUBY_BOOTS = InitUtils.setup(new ItemTRArmour(Reference.RUBY_ARMOUR, EntityEquipmentSlot.FEET, "gemRuby"), "ruby_boots")); + + RebornRegistry.registerItem(TRContent.SAPPHIRE_SWORD = InitUtils.setup(new ItemTRSword(Reference.SAPPHIRE, "gemSapphire"), "sapphire_sword")); + RebornRegistry.registerItem(TRContent.SAPPHIRE_PICKAXE = InitUtils.setup(new ItemTRSword(Reference.SAPPHIRE, "gemSapphire"), "sapphire_pickaxe")); + RebornRegistry.registerItem(TRContent.SAPPHIRE_SPADE = InitUtils.setup(new ItemTRSpade(Reference.SAPPHIRE, "gemSapphire"), "sapphire_spade")); + RebornRegistry.registerItem(TRContent.SAPPHIRE_AXE = InitUtils.setup(new ItemTRAxe(Reference.SAPPHIRE, "gemSapphire"), "sapphire_axe")); + RebornRegistry.registerItem(TRContent.SAPPHIRE_HOE = InitUtils.setup(new ItemTRHoe(Reference.SAPPHIRE, "gemSapphire"), "sapphire_hoe")); + + RebornRegistry.registerItem(TRContent.SAPPHIRE_HELMET = InitUtils.setup(new ItemTRArmour(Reference.SAPPHIRE_ARMOUR, EntityEquipmentSlot.HEAD, "gemSapphire"), "sapphire_helmet")); + RebornRegistry.registerItem(TRContent.SAPPHIRE_CHESTPLATE = InitUtils.setup(new ItemTRArmour(Reference.SAPPHIRE_ARMOUR, EntityEquipmentSlot.CHEST, "gemSapphire"), "sapphire_chestplate")); + RebornRegistry.registerItem(TRContent.SAPPHIRE_LEGGINGS = InitUtils.setup(new ItemTRArmour(Reference.SAPPHIRE_ARMOUR, EntityEquipmentSlot.LEGS, "gemSapphire"), "sapphire_leggings")); + RebornRegistry.registerItem(TRContent.SAPPHIRE_BOOTS = InitUtils.setup(new ItemTRArmour(Reference.SAPPHIRE_ARMOUR, EntityEquipmentSlot.FEET, "gemSapphire"), "sapphire_boots")); + + RebornRegistry.registerItem(TRContent.PERIDOT_SWORD = InitUtils.setup(new ItemTRSword(Reference.PERIDOT, "gemPeridot"), "peridot_sword")); + RebornRegistry.registerItem(TRContent.PERIDOT_PICKAXE = InitUtils.setup(new ItemTRSword(Reference.PERIDOT, "gemPeridot"), "peridot_pickaxe")); + RebornRegistry.registerItem(TRContent.PERIDOT_SPADE = InitUtils.setup(new ItemTRSpade(Reference.PERIDOT, "gemPeridot"), "peridot_spade")); + RebornRegistry.registerItem(TRContent.PERIDOT_AXE = InitUtils.setup(new ItemTRAxe(Reference.PERIDOT, "gemPeridot"), "peridot_axe")); + RebornRegistry.registerItem(TRContent.PERIDOT_HOE = InitUtils.setup(new ItemTRHoe(Reference.PERIDOT, "gemPeridot"), "peridot_hoe")); + + RebornRegistry.registerItem(TRContent.PERIDOT_HELMET = InitUtils.setup(new ItemTRArmour(Reference.PERIDOT_ARMOUR, EntityEquipmentSlot.HEAD, "gemPeridot"), "peridot_helmet")); + RebornRegistry.registerItem(TRContent.PERIDOT_CHESTPLATE = InitUtils.setup(new ItemTRArmour(Reference.PERIDOT_ARMOUR, EntityEquipmentSlot.CHEST, "gemPeridot"), "peridot_chestplate")); + RebornRegistry.registerItem(TRContent.PERIDOT_LEGGINGS = InitUtils.setup(new ItemTRArmour(Reference.PERIDOT_ARMOUR, EntityEquipmentSlot.LEGS, "gemPeridot"), "peridot_leggings")); + RebornRegistry.registerItem(TRContent.PERIDOT_BOOTS = InitUtils.setup(new ItemTRArmour(Reference.PERIDOT_ARMOUR, EntityEquipmentSlot.FEET, "gemPeridot"), "peridot_boots")); + } + + // Battery + RebornRegistry.registerItem(TRContent.RED_CELL_BATTERY = InitUtils.setup(new ItemRedCellBattery(), "red_cell_battery")); + RebornRegistry.registerItem(TRContent.LITHIUM_ION_BATTERY = InitUtils.setup(new ItemLithiumIonBattery(), "lithium_ion_battery")); + RebornRegistry.registerItem(TRContent.LITHIUM_ION_BATPACK = InitUtils.setup(new ItemLithiumIonBatpack(), "lithium_ion_batpack")); + RebornRegistry.registerItem(TRContent.ENERGY_CRYSTAL = InitUtils.setup(new ItemEnergyCrystal(), "energy_crystal")); + RebornRegistry.registerItem(TRContent.LAPOTRON_CRYSTAL = InitUtils.setup(new ItemLapotronCrystal(), "lapotron_crystal")); + RebornRegistry.registerItem(TRContent.LAPOTRONIC_ORB = InitUtils.setup(new ItemLapotronicOrb(), "lapotronic_orb")); + RebornRegistry.registerItem(TRContent.LAPOTRONIC_ORBPACK = InitUtils.setup(new ItemLapotronicOrbpack(), "lapotronic_orbpack")); + + // Tools + RebornRegistry.registerItem(TRContent.TREE_TAP = InitUtils.setup(new ItemTreeTap(), "treetap")); + RebornRegistry.registerItem(TRContent.WRENCH = InitUtils.setup(new ItemWrench(), "wrench")); + + RebornRegistry.registerItem(TRContent.BASIC_DRILL = InitUtils.setup(new ItemBasicDrill(), "basic_drill")); + RebornRegistry.registerItem(TRContent.BASIC_CHAINSAW = InitUtils.setup(new ItemBasicChainsaw(), "basic_chainsaw")); + RebornRegistry.registerItem(TRContent.BASIC_JACKHAMMER = InitUtils.setup(new ItemBasicJackhammer(), "basic_jackhammer")); + RebornRegistry.registerItem(TRContent.ELECTRIC_TREE_TAP = InitUtils.setup(new ItemElectricTreetap(), "electric_treetap")); + + RebornRegistry.registerItem(TRContent.ADVANCED_DRILL = InitUtils.setup(new ItemAdvancedDrill(), "advanced_drill")); + RebornRegistry.registerItem(TRContent.ADVANCED_CHAINSAW = InitUtils.setup(new ItemAdvancedChainsaw(), "advanced_chainsaw")); + RebornRegistry.registerItem(TRContent.ADVANCED_JACKHAMMER = InitUtils.setup(new ItemAdvancedJackhammer(), "advanced_jackhammer")); + RebornRegistry.registerItem(TRContent.ROCK_CUTTER = InitUtils.setup(new ItemRockCutter(), "rock_cutter")); + + RebornRegistry.registerItem(TRContent.INDUSTRIAL_DRILL = InitUtils.setup(new ItemIndustrialDrill(), "industrial_drill")); + RebornRegistry.registerItem(TRContent.INDUSTRIAL_CHAINSAW = InitUtils.setup(new ItemIndustrialChainsaw(), "industrial_chainsaw")); + RebornRegistry.registerItem(TRContent.INDUSTRIAL_JACKHAMMER = InitUtils.setup(new ItemIndustrialJackhammer(), "industrial_jackhammer")); + RebornRegistry.registerItem(TRContent.NANOSABER = InitUtils.setup(new ItemNanosaber(), "nanosaber")); + RebornRegistry.registerItem(TRContent.OMNI_TOOL = InitUtils.setup(new ItemOmniTool(), "omni_tool")); + + // Armor + RebornRegistry.registerItem(TRContent.CLOAKING_DEVICE = InitUtils.setup(new ItemCloakingDevice(), "cloaking_device")); + + // Other + RebornRegistry.registerItem(TRContent.FREQUENCY_TRANSMITTER = InitUtils.setup(new ItemFrequencyTransmitter(), "frequency_transmitter")); + RebornRegistry.registerItem(TRContent.SCRAP_BOX = InitUtils.setup(new ItemScrapBox(), "scrap_box")); + RebornRegistry.registerItem(TRContent.MANUAL = InitUtils.setup(new ItemManual(), "manual")); + RebornRegistry.registerItem(TRContent.DEBUG_TOOL = InitUtils.setup(new ItemDebugTool(), "debug_tool")); + RebornRegistry.registerItem(TRContent.CELL = InitUtils.setup(new DynamicCell(), "cell")); + MinecraftForge.EVENT_BUS.register(BucketHandler.INSTANCE); + + // TODO: do we need this at all? + BlockMachineBase.advancedFrameStack = new ItemStack(TRContent.MachineBlocks.ADVANCED.getFrame()); + BlockMachineBase.basicFrameStack = new ItemStack(TRContent.MachineBlocks.BASIC.getFrame()); + + TechReborn.LOGGER.debug("TechReborns Items Loaded"); + } + + @SubscribeEvent(priority = EventPriority.LOW)//LOW is used as we want it to load as late as possible, but before crafttweaker + public static void registerRecipes(RegistryEvent.Register event) { + //Register ModRecipes + ModRecipes.init(); + } } diff --git a/src/main/java/techreborn/init/TRContent.java b/src/main/java/techreborn/init/TRContent.java index 03775e4fa..fc0cd575c 100644 --- a/src/main/java/techreborn/init/TRContent.java +++ b/src/main/java/techreborn/init/TRContent.java @@ -1,33 +1,15 @@ package techreborn.init; -import com.google.common.collect.Maps; import net.minecraft.block.Block; -import net.minecraft.block.BlockSlab; -import net.minecraft.block.properties.IProperty; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; -import net.minecraft.client.renderer.block.statemap.DefaultStateMapper; -import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemSlab; import net.minecraft.item.ItemStack; import net.minecraft.util.IItemProvider; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.ModelLoader; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -import reborncore.RebornRegistry; import reborncore.api.power.EnumPowerTier; import reborncore.api.tile.IUpgrade; -import reborncore.common.blocks.BlockMachineBase; import reborncore.common.powerSystem.TilePowerAcceptor; import reborncore.common.registration.RebornRegister; import reborncore.common.registration.impl.ConfigRegistry; -import reborncore.common.util.BucketHandler; import techreborn.TechReborn; -import techreborn.api.Reference; import techreborn.blocks.*; import techreborn.blocks.cable.BlockCable; import techreborn.blocks.generator.*; @@ -42,34 +24,10 @@ import techreborn.blocks.transformers.BlockHVTransformer; import techreborn.blocks.transformers.BlockLVTransformer; import techreborn.blocks.transformers.BlockMVTransformer; import techreborn.config.ConfigTechReborn; -import techreborn.itemblocks.ItemBlockRubberSapling; import techreborn.items.*; -import techreborn.items.armor.ItemCloakingDevice; -import techreborn.items.armor.ItemLapotronicOrbpack; -import techreborn.items.armor.ItemLithiumIonBatpack; -import techreborn.items.armor.ItemTRArmour; -import techreborn.items.battery.*; -import techreborn.items.tool.ItemDebugTool; -import techreborn.items.tool.ItemTreeTap; -import techreborn.items.tool.ItemWrench; -import techreborn.items.tool.advanced.ItemAdvancedChainsaw; -import techreborn.items.tool.advanced.ItemAdvancedDrill; -import techreborn.items.tool.advanced.ItemAdvancedJackhammer; -import techreborn.items.tool.advanced.ItemRockCutter; -import techreborn.items.tool.basic.ItemBasicChainsaw; -import techreborn.items.tool.basic.ItemBasicDrill; -import techreborn.items.tool.basic.ItemBasicJackhammer; -import techreborn.items.tool.basic.ItemElectricTreetap; -import techreborn.items.tool.industrial.*; -import techreborn.items.tool.vanilla.ItemTRAxe; -import techreborn.items.tool.vanilla.ItemTRHoe; -import techreborn.items.tool.vanilla.ItemTRSpade; -import techreborn.items.tool.vanilla.ItemTRSword; import techreborn.utils.InitUtils; import javax.annotation.Nullable; -import java.util.Arrays; -import java.util.Map; @RebornRegister(modID = TechReborn.MOD_ID) public class TRContent { @@ -714,200 +672,4 @@ public class TRContent { return item; } } - - public static void registerItems() { - Arrays.stream(Ingots.values()).forEach(value -> RebornRegistry.registerItem(value.item)); - Arrays.stream(Nuggets.values()).forEach(value -> RebornRegistry.registerItem(value.item)); - Arrays.stream(Gems.values()).forEach(value -> RebornRegistry.registerItem(value.item)); - Arrays.stream(Dusts.values()).forEach(value -> RebornRegistry.registerItem(value.item)); - Arrays.stream(SmallDusts.values()).forEach(value -> RebornRegistry.registerItem(value.item)); - Arrays.stream(Plates.values()).forEach(value -> RebornRegistry.registerItem(value.item)); - Arrays.stream(Parts.values()).forEach(value -> RebornRegistry.registerItem(value.item)); - Arrays.stream(Upgrades.values()).forEach(value -> RebornRegistry.registerItem(value.item)); - - // Gem armor & tools - if (ConfigTechReborn.enableGemArmorAndTools) { - //Todo: repair with tags - RebornRegistry.registerItem(BRONZE_SWORD = InitUtils.setup(new ItemTRSword(Reference.BRONZE, "ingotBronze"), "bronze_sword")); - RebornRegistry.registerItem(BRONZE_PICKAXE = InitUtils.setup(new ItemTRSword(Reference.BRONZE, "ingotBronze"), "bronze_pickaxe")); - RebornRegistry.registerItem(BRONZE_SPADE = InitUtils.setup(new ItemTRSpade(Reference.BRONZE, "ingotBronze"), "bronze_spade")); - RebornRegistry.registerItem(BRONZE_AXE = InitUtils.setup(new ItemTRAxe(Reference.BRONZE, "ingotBronze"), "bronze_axe")); - RebornRegistry.registerItem(BRONZE_HOE = InitUtils.setup(new ItemTRHoe(Reference.BRONZE, "ingotBronze"), "bronze_hoe")); - - RebornRegistry.registerItem(BRONZE_HELMET = InitUtils.setup(new ItemTRArmour(Reference.BRONZE_ARMOUR, EntityEquipmentSlot.HEAD, "ingotBronze"), "bronze_helmet")); - RebornRegistry.registerItem(BRONZE_CHESTPLATE = InitUtils.setup(new ItemTRArmour(Reference.BRONZE_ARMOUR, EntityEquipmentSlot.CHEST, "ingotBronze"), "bronze_chestplate")); - RebornRegistry.registerItem(BRONZE_LEGGINGS = InitUtils.setup(new ItemTRArmour(Reference.BRONZE_ARMOUR, EntityEquipmentSlot.LEGS, "ingotBronze"), "bronze_leggings")); - RebornRegistry.registerItem(BRONZE_BOOTS = InitUtils.setup(new ItemTRArmour(Reference.BRONZE_ARMOUR, EntityEquipmentSlot.FEET, "ingotBronze"), "bronze_boots")); - - RebornRegistry.registerItem(RUBY_SWORD = InitUtils.setup(new ItemTRSword(Reference.RUBY, "gemRuby"), "ruby_sword")); - RebornRegistry.registerItem(RUBY_PICKAXE = InitUtils.setup(new ItemTRSword(Reference.RUBY, "gemRuby"), "ruby_pickaxe")); - RebornRegistry.registerItem(RUBY_SPADE = InitUtils.setup(new ItemTRSpade(Reference.RUBY, "gemRuby"), "ruby_spade")); - RebornRegistry.registerItem(RUBY_AXE = InitUtils.setup(new ItemTRAxe(Reference.RUBY, "gemRuby"), "ruby_axe")); - RebornRegistry.registerItem(RUBY_HOE = InitUtils.setup(new ItemTRHoe(Reference.RUBY, "gemRuby"), "ruby_hoe")); - - RebornRegistry.registerItem(RUBY_HELMET = InitUtils.setup(new ItemTRArmour(Reference.RUBY_ARMOUR, EntityEquipmentSlot.HEAD, "gemRuby"), "ruby_helmet")); - RebornRegistry.registerItem(RUBY_CHESTPLATE = InitUtils.setup(new ItemTRArmour(Reference.RUBY_ARMOUR, EntityEquipmentSlot.CHEST, "gemRuby"), "ruby_chestplate")); - RebornRegistry.registerItem(RUBY_LEGGINGS = InitUtils.setup(new ItemTRArmour(Reference.RUBY_ARMOUR, EntityEquipmentSlot.LEGS, "gemRuby"), "ruby_leggings")); - RebornRegistry.registerItem(RUBY_BOOTS = InitUtils.setup(new ItemTRArmour(Reference.RUBY_ARMOUR, EntityEquipmentSlot.FEET, "gemRuby"), "ruby_boots")); - - RebornRegistry.registerItem(SAPPHIRE_SWORD = InitUtils.setup(new ItemTRSword(Reference.SAPPHIRE, "gemSapphire"), "sapphire_sword")); - RebornRegistry.registerItem(SAPPHIRE_PICKAXE = InitUtils.setup(new ItemTRSword(Reference.SAPPHIRE, "gemSapphire"), "sapphire_pickaxe")); - RebornRegistry.registerItem(SAPPHIRE_SPADE = InitUtils.setup(new ItemTRSpade(Reference.SAPPHIRE, "gemSapphire"), "sapphire_spade")); - RebornRegistry.registerItem(SAPPHIRE_AXE = InitUtils.setup(new ItemTRAxe(Reference.SAPPHIRE, "gemSapphire"), "sapphire_axe")); - RebornRegistry.registerItem(SAPPHIRE_HOE = InitUtils.setup(new ItemTRHoe(Reference.SAPPHIRE, "gemSapphire"), "sapphire_hoe")); - - RebornRegistry.registerItem(SAPPHIRE_HELMET = InitUtils.setup(new ItemTRArmour(Reference.SAPPHIRE_ARMOUR, EntityEquipmentSlot.HEAD, "gemSapphire"), "sapphire_helmet")); - RebornRegistry.registerItem(SAPPHIRE_CHESTPLATE = InitUtils.setup(new ItemTRArmour(Reference.SAPPHIRE_ARMOUR, EntityEquipmentSlot.CHEST, "gemSapphire"), "sapphire_chestplate")); - RebornRegistry.registerItem(SAPPHIRE_LEGGINGS = InitUtils.setup(new ItemTRArmour(Reference.SAPPHIRE_ARMOUR, EntityEquipmentSlot.LEGS, "gemSapphire"), "sapphire_leggings")); - RebornRegistry.registerItem(SAPPHIRE_BOOTS = InitUtils.setup(new ItemTRArmour(Reference.SAPPHIRE_ARMOUR, EntityEquipmentSlot.FEET, "gemSapphire"), "sapphire_boots")); - - RebornRegistry.registerItem(PERIDOT_SWORD = InitUtils.setup(new ItemTRSword(Reference.PERIDOT, "gemPeridot"), "peridot_sword")); - RebornRegistry.registerItem(PERIDOT_PICKAXE = InitUtils.setup(new ItemTRSword(Reference.PERIDOT, "gemPeridot"), "peridot_pickaxe")); - RebornRegistry.registerItem(PERIDOT_SPADE = InitUtils.setup(new ItemTRSpade(Reference.PERIDOT, "gemPeridot"), "peridot_spade")); - RebornRegistry.registerItem(PERIDOT_AXE = InitUtils.setup(new ItemTRAxe(Reference.PERIDOT, "gemPeridot"), "peridot_axe")); - RebornRegistry.registerItem(PERIDOT_HOE = InitUtils.setup(new ItemTRHoe(Reference.PERIDOT, "gemPeridot"), "peridot_hoe")); - - RebornRegistry.registerItem(PERIDOT_HELMET = InitUtils.setup(new ItemTRArmour(Reference.PERIDOT_ARMOUR, EntityEquipmentSlot.HEAD, "gemPeridot"), "peridot_helmet")); - RebornRegistry.registerItem(PERIDOT_CHESTPLATE = InitUtils.setup(new ItemTRArmour(Reference.PERIDOT_ARMOUR, EntityEquipmentSlot.CHEST, "gemPeridot"), "peridot_chestplate")); - RebornRegistry.registerItem(PERIDOT_LEGGINGS = InitUtils.setup(new ItemTRArmour(Reference.PERIDOT_ARMOUR, EntityEquipmentSlot.LEGS, "gemPeridot"), "peridot_leggings")); - RebornRegistry.registerItem(PERIDOT_BOOTS = InitUtils.setup(new ItemTRArmour(Reference.PERIDOT_ARMOUR, EntityEquipmentSlot.FEET, "gemPeridot"), "peridot_boots")); - } - - // Battery - RebornRegistry.registerItem(RED_CELL_BATTERY = InitUtils.setup(new ItemRedCellBattery(), "red_cell_battery")); - RebornRegistry.registerItem(LITHIUM_ION_BATTERY = InitUtils.setup(new ItemLithiumIonBattery(), "lithium_ion_battery")); - RebornRegistry.registerItem(LITHIUM_ION_BATPACK = InitUtils.setup(new ItemLithiumIonBatpack(), "lithium_ion_batpack")); - RebornRegistry.registerItem(ENERGY_CRYSTAL = InitUtils.setup(new ItemEnergyCrystal(), "energy_crystal")); - RebornRegistry.registerItem(LAPOTRON_CRYSTAL = InitUtils.setup(new ItemLapotronCrystal(), "lapotron_crystal")); - RebornRegistry.registerItem(LAPOTRONIC_ORB = InitUtils.setup(new ItemLapotronicOrb(), "lapotronic_orb")); - RebornRegistry.registerItem(LAPOTRONIC_ORBPACK = InitUtils.setup(new ItemLapotronicOrbpack(), "lapotronic_orbpack")); - - // Tools - RebornRegistry.registerItem(TREE_TAP = InitUtils.setup(new ItemTreeTap(), "treetap")); - RebornRegistry.registerItem(WRENCH = InitUtils.setup(new ItemWrench(), "wrench")); - - RebornRegistry.registerItem(BASIC_DRILL = InitUtils.setup(new ItemBasicDrill(), "basic_drill")); - RebornRegistry.registerItem(BASIC_CHAINSAW = InitUtils.setup(new ItemBasicChainsaw(), "basic_chainsaw")); - RebornRegistry.registerItem(BASIC_JACKHAMMER = InitUtils.setup(new ItemBasicJackhammer(), "basic_jackhammer")); - RebornRegistry.registerItem(ELECTRIC_TREE_TAP = InitUtils.setup(new ItemElectricTreetap(), "electric_treetap")); - - RebornRegistry.registerItem(ADVANCED_DRILL = InitUtils.setup(new ItemAdvancedDrill(), "advanced_drill")); - RebornRegistry.registerItem(ADVANCED_CHAINSAW = InitUtils.setup(new ItemAdvancedChainsaw(), "advanced_chainsaw")); - RebornRegistry.registerItem(ADVANCED_JACKHAMMER = InitUtils.setup(new ItemAdvancedJackhammer(), "advanced_jackhammer")); - RebornRegistry.registerItem(ROCK_CUTTER = InitUtils.setup(new ItemRockCutter(), "rock_cutter")); - - RebornRegistry.registerItem(INDUSTRIAL_DRILL = InitUtils.setup(new ItemIndustrialDrill(), "industrial_drill")); - RebornRegistry.registerItem(INDUSTRIAL_CHAINSAW = InitUtils.setup(new ItemIndustrialChainsaw(), "industrial_chainsaw")); - RebornRegistry.registerItem(INDUSTRIAL_JACKHAMMER = InitUtils.setup(new ItemIndustrialJackhammer(), "industrial_jackhammer")); - RebornRegistry.registerItem(NANOSABER = InitUtils.setup(new ItemNanosaber(), "nanosaber")); - RebornRegistry.registerItem(OMNI_TOOL = InitUtils.setup(new ItemOmniTool(), "omni_tool")); - - // Armor - RebornRegistry.registerItem(CLOAKING_DEVICE = InitUtils.setup(new ItemCloakingDevice(), "cloaking_device")); - - // Other - RebornRegistry.registerItem(FREQUENCY_TRANSMITTER = InitUtils.setup(new ItemFrequencyTransmitter(), "frequency_transmitter")); - RebornRegistry.registerItem(SCRAP_BOX = InitUtils.setup(new ItemScrapBox(), "scrap_box")); - RebornRegistry.registerItem(MANUAL = InitUtils.setup(new ItemManual(), "manual")); - RebornRegistry.registerItem(DEBUG_TOOL = InitUtils.setup(new ItemDebugTool(), "debug_tool")); - RebornRegistry.registerItem(CELL = InitUtils.setup(new DynamicCell(), "cell")); - MinecraftForge.EVENT_BUS.register(BucketHandler.INSTANCE); - - // TODO: do we need this at all? - BlockMachineBase.advancedFrameStack = new ItemStack(TRContent.MachineBlocks.ADVANCED.getFrame()); - BlockMachineBase.basicFrameStack = new ItemStack(TRContent.MachineBlocks.BASIC.getFrame()); - - TechReborn.LOGGER.debug("TechReborns Items Loaded"); - } - - @SideOnly(Side.CLIENT) - public static void registerModel() { - ResourceLocation dustsRL = new ResourceLocation(TechReborn.MOD_ID, "items/material/dust"); - Arrays.stream(Dusts.values()).forEach(value -> ModelLoader.setCustomModelResourceLocation(value.item, 0, - new ModelResourceLocation(dustsRL, "type=" + value.name))); - - ResourceLocation dustsSmallRL = new ResourceLocation(TechReborn.MOD_ID, "items/material/small_dust"); - Arrays.stream(SmallDusts.values()).forEach(value -> ModelLoader.setCustomModelResourceLocation(value.item, 0, - new ModelResourceLocation(dustsSmallRL, "type=" + value.name))); - - ResourceLocation gemsRL = new ResourceLocation(TechReborn.MOD_ID, "items/material/gem"); - Arrays.stream(Gems.values()).forEach(value -> ModelLoader.setCustomModelResourceLocation(value.item, 0, - new ModelResourceLocation(gemsRL, "type=" + value.name))); - - ResourceLocation ingotsRL = new ResourceLocation(TechReborn.MOD_ID, "items/material/ingot"); - Arrays.stream(Ingots.values()).forEach(value -> ModelLoader.setCustomModelResourceLocation(value.item, 0, - new ModelResourceLocation(ingotsRL, "type=" + value.name))); - - ResourceLocation nuggetsRL = new ResourceLocation(TechReborn.MOD_ID, "items/material/nugget"); - Arrays.stream(Nuggets.values()).forEach(value -> ModelLoader.setCustomModelResourceLocation(value.item, 0, - new ModelResourceLocation(nuggetsRL, "type=" + value.name))); - - ResourceLocation partsRL = new ResourceLocation(TechReborn.MOD_ID, "items/material/part"); - Arrays.stream(Parts.values()).forEach(value -> ModelLoader.setCustomModelResourceLocation(value.item, 0, - new ModelResourceLocation(partsRL, "type=" + value.name))); - - ResourceLocation platesRL = new ResourceLocation(TechReborn.MOD_ID, "items/material/plate"); - Arrays.stream(Plates.values()).forEach(value -> ModelLoader.setCustomModelResourceLocation(value.item, 0, - new ModelResourceLocation(platesRL, "type=" + value.name))); - - ResourceLocation upgradeRL = new ResourceLocation(TechReborn.MOD_ID, "items/misc/upgrades"); - Arrays.stream(Upgrades.values()).forEach(value -> ModelLoader.setCustomModelResourceLocation(value.item, 0, - new ModelResourceLocation(upgradeRL, "type=" + value.name))); - - ResourceLocation oresRL = new ResourceLocation(TechReborn.MOD_ID, "ore"); - for (Ores value : Ores.values()) { - ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(value.block), 0, new ModelResourceLocation(oresRL, "type=" + value.name)); - ModelLoader.setCustomStateMapper(value.block, new DefaultStateMapper() { - @Override - protected ModelResourceLocation getModelResourceLocation(IBlockState state) { - return new ModelResourceLocation(oresRL, "type=" + value.name); - } - }); - } - - ResourceLocation storageRL = new ResourceLocation(TechReborn.MOD_ID, "storage_block"); - for (StorageBlocks value : StorageBlocks.values()) { - ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(value.block), 0, new ModelResourceLocation(storageRL, "type=" + value.name)); - ModelLoader.setCustomStateMapper(value.block, new DefaultStateMapper() { - @Override - protected ModelResourceLocation getModelResourceLocation(IBlockState state) { - return new ModelResourceLocation(storageRL, "type=" + value.name); - } - }); - } - - ResourceLocation machineBlockRL = new ResourceLocation(TechReborn.MOD_ID, "machine_block"); - for (MachineBlocks value : MachineBlocks.values()) { - ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(value.frame), 0, new ModelResourceLocation(machineBlockRL, "type=" + value.name + "_machine_frame")); - ModelLoader.setCustomStateMapper(value.frame, new DefaultStateMapper() { - @Override - protected ModelResourceLocation getModelResourceLocation(IBlockState state) { - return new ModelResourceLocation(machineBlockRL, "type=" + value.name + "_machine_frame"); - } - }); - ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(value.casing), 0, new ModelResourceLocation(machineBlockRL, "type=" + value.name + "_machine_casing")); - ModelLoader.setCustomStateMapper(value.casing, new DefaultStateMapper() { - @Override - protected ModelResourceLocation getModelResourceLocation(IBlockState state) { - return new ModelResourceLocation(machineBlockRL, "type=" + value.name + "_machine_casing"); - } - }); - } - - ResourceLocation cableRL = new ResourceLocation(TechReborn.MOD_ID, "cable_inv"); - for (Cables value : Cables.values()) { - ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(value.block), 0, - new ModelResourceLocation(cableRL, "type=" + value.name)); - ModelLoader.setCustomStateMapper(value.block, new DefaultStateMapper() { - @Override - protected ModelResourceLocation getModelResourceLocation(IBlockState state) { - Map, Comparable> map = Maps.newLinkedHashMap(state.getProperties()); - String property = this.getPropertyString(map) + ",ztype=" + value.name; - - return new ModelResourceLocation(new ResourceLocation(TechReborn.MOD_ID, - "cable_" + (value.cableThickness == 5 ? "thick" : "thin")), property); - } - }); - } - } } diff --git a/src/main/java/techreborn/proxies/ClientProxy.java b/src/main/java/techreborn/proxies/ClientProxy.java index 6b84d222b..fdf5f2520 100644 --- a/src/main/java/techreborn/proxies/ClientProxy.java +++ b/src/main/java/techreborn/proxies/ClientProxy.java @@ -39,21 +39,16 @@ import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import reborncore.api.tile.IUpgradeable; import reborncore.client.hud.StackInfoHUD; -import reborncore.client.models.RebornModelRegistry; import reborncore.client.multiblock.MultiblockRenderEvent; -import techreborn.TechReborn; import techreborn.blocks.BlockRubberLeaves; import techreborn.client.ClientEventHandler; import techreborn.client.IconSupplier; -import techreborn.client.RegisterItemJsons; import techreborn.client.gui.GuiBase; import techreborn.client.gui.slot.GuiFluidConfiguration; import techreborn.client.gui.slot.GuiSlotConfiguration; import techreborn.client.keybindings.KeyBindings; -import techreborn.client.render.ModelDynamicCell; import techreborn.client.render.entitys.RenderNukePrimed; import techreborn.entities.EntityNukePrimed; -import techreborn.events.FluidBlockModelHandler; import techreborn.events.StackToolTipEvent; import techreborn.init.TRContent; import techreborn.items.ItemFrequencyTransmitter; @@ -65,13 +60,9 @@ public class ClientProxy extends CommonProxy { @Override public void preInit(FMLPreInitializationEvent event) { super.preInit(event); - RebornModelRegistry.registerModels(TechReborn.MOD_ID); StackInfoHUD.registerElement(new ItemFrequencyTransmitter.StackInfoFreqTransmitter()); RenderingRegistry.registerEntityRenderingHandler(EntityNukePrimed.class, new RenderManagerNuke()); - ModelDynamicCell.init(); - RegisterItemJsons.registerModels(); MinecraftForge.EVENT_BUS.register(new IconSupplier()); - MinecraftForge.EVENT_BUS.register(new FluidBlockModelHandler()); MinecraftForge.EVENT_BUS.register(ClientEventHandler.class); }