diff --git a/src/main/java/techreborn/init/ModParts.java b/src/main/java/techreborn/init/ModParts.java index f0c223006..91920fa74 100644 --- a/src/main/java/techreborn/init/ModParts.java +++ b/src/main/java/techreborn/init/ModParts.java @@ -1,15 +1,22 @@ package techreborn.init; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import techreborn.partSystem.IPartProvider; import techreborn.partSystem.ModPartRegistry; import techreborn.partSystem.parts.CablePart; +import java.util.HashMap; + public class ModParts { + public static HashMap stackCable = new HashMap(); + public static void init() { for (int i = 0; i < 13; i++) { - ModPartRegistry.registerPart(new CablePart(i)); + CablePart part = new CablePart(i); + ModPartRegistry.registerPart(part); } ModPartRegistry.addProvider( "techreborn.partSystem.QLib.QModPartFactory", "qmunitylib"); @@ -21,5 +28,11 @@ public class ModParts { ModPartRegistry.masterProvider = provider; } } + for (int i = 0; i < 13; i++) { + Item stack = ModPartRegistry.itemParts.get("Cable." + i); + if(stack != null){ + stackCable.put(i, new ItemStack(stack)); + } + } } } diff --git a/src/main/java/techreborn/init/ModRecipes.java b/src/main/java/techreborn/init/ModRecipes.java index 6d5442f6c..bb6594a3c 100644 --- a/src/main/java/techreborn/init/ModRecipes.java +++ b/src/main/java/techreborn/init/ModRecipes.java @@ -1,5 +1,6 @@ package techreborn.init; +import cpw.mods.fml.common.registry.GameRegistry; import ic2.api.item.IC2Items; import net.minecraft.init.Blocks; import net.minecraft.init.Items; @@ -7,23 +8,19 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.oredict.OreDictionary; -import techreborn.api.BlastFurnaceRecipe; -import techreborn.api.TechRebornAPI; import techreborn.api.recipe.RecipeHandler; import techreborn.api.recipe.machines.AlloySmelterRecipe; -import techreborn.api.recipe.machines.AssemblingMachineRecipe; -import techreborn.api.recipe.machines.CentrifugeRecipe; -import techreborn.api.recipe.machines.ChemicalReactorRecipe; -import techreborn.api.recipe.machines.GrinderRecipe; -import techreborn.api.recipe.machines.ImplosionCompressorRecipe; import techreborn.api.recipe.machines.IndustrialSawmillRecipe; import techreborn.api.recipe.machines.LatheRecipe; import techreborn.api.recipe.machines.PlateCuttingMachineRecipe; import techreborn.config.ConfigTechReborn; -import techreborn.items.*; +import techreborn.items.ItemDusts; +import techreborn.items.ItemIngots; +import techreborn.items.ItemParts; +import techreborn.items.ItemPlates; +import techreborn.items.ItemRods; import techreborn.util.CraftingHelper; import techreborn.util.LogHelper; -import cpw.mods.fml.common.registry.GameRegistry; public class ModRecipes { public static ConfigTechReborn config; diff --git a/src/main/java/techreborn/partSystem/ModPartRegistry.java b/src/main/java/techreborn/partSystem/ModPartRegistry.java index 948de96f0..a5fe4575b 100644 --- a/src/main/java/techreborn/partSystem/ModPartRegistry.java +++ b/src/main/java/techreborn/partSystem/ModPartRegistry.java @@ -8,8 +8,12 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Map; +import ic2.api.item.IC2Items; import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; import techreborn.client.TechRebornCreativeTab; +import techreborn.init.ModParts; +import techreborn.partSystem.parts.CablePart; import techreborn.util.LogHelper; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.registry.GameRegistry; @@ -22,7 +26,7 @@ public class ModPartRegistry { public static IPartProvider masterProvider = null; - public static Map itemParts = new HashMap(); + public static Map itemParts = new HashMap(); public static void registerPart(ModPart iModPart) { parts.add(iModPart); @@ -38,7 +42,10 @@ public class ModPartRegistry { .setCreativeTab(TechRebornCreativeTab.instance) .setTextureName(modPart.getItemTextureName()); GameRegistry.registerItem(part, modPart.getName()); - itemParts.put(part, modPart.getName()); + itemParts.put(modPart.getName(), part); + if(modPart instanceof CablePart){ + GameRegistry.addShapelessRecipe(new ItemStack(part), IC2Items.getItem(CablePart.getTextureNameFromType(((CablePart) modPart).type))); + } } for (IPartProvider iPartProvider : providers) { @@ -47,9 +54,9 @@ public class ModPartRegistry { } public static Item getItem(String string) { - for (Map.Entry entry : itemParts.entrySet()) { + for (Map.Entry entry : itemParts.entrySet()) { if (entry.getValue().equals(string)) { - return entry.getKey(); + return entry.getValue(); } } return null; diff --git a/src/main/java/techreborn/partSystem/ModPartUtils.java b/src/main/java/techreborn/partSystem/ModPartUtils.java index 4ccb6d754..5e6f65c38 100644 --- a/src/main/java/techreborn/partSystem/ModPartUtils.java +++ b/src/main/java/techreborn/partSystem/ModPartUtils.java @@ -61,10 +61,10 @@ public class ModPartUtils { } public static Item getItemForPart(String string) { - for (Map.Entry item : ModPartRegistry.itemParts + for (Map.Entry item : ModPartRegistry.itemParts .entrySet()) { if (item.getValue().equals(string)) { - return item.getKey(); + return item.getValue(); } } return null; diff --git a/src/main/java/techreborn/partSystem/parts/CablePart.java b/src/main/java/techreborn/partSystem/parts/CablePart.java index 8e6c7d3c0..02b6f415a 100644 --- a/src/main/java/techreborn/partSystem/parts/CablePart.java +++ b/src/main/java/techreborn/partSystem/parts/CablePart.java @@ -297,10 +297,10 @@ public class CablePart extends ModPart implements IEnergyConductor { public static float getCableThickness(int cableType) { float p = 1.0F; switch(cableType) { - case 0: + case 1: p = 6.0F; break; - case 1: + case 0: p = 4.0F; break; case 2: