Added a way to get the fmp cables in survival, will make this better later
This commit is contained in:
parent
482c07d991
commit
84fc33edab
5 changed files with 35 additions and 18 deletions
|
@ -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<Integer, ItemStack> stackCable = new HashMap<Integer, ItemStack>();
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<Item, String> itemParts = new HashMap<Item, String>();
|
||||
public static Map<String, Item> itemParts = new HashMap<String, Item>();
|
||||
|
||||
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<Item, String> entry : itemParts.entrySet()) {
|
||||
for (Map.Entry<String, Item> entry : itemParts.entrySet()) {
|
||||
if (entry.getValue().equals(string)) {
|
||||
return entry.getKey();
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -61,10 +61,10 @@ public class ModPartUtils {
|
|||
}
|
||||
|
||||
public static Item getItemForPart(String string) {
|
||||
for (Map.Entry<Item, String> item : ModPartRegistry.itemParts
|
||||
for (Map.Entry<String, Item> item : ModPartRegistry.itemParts
|
||||
.entrySet()) {
|
||||
if (item.getValue().equals(string)) {
|
||||
return item.getKey();
|
||||
return item.getValue();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue