Fix some bugs&crashes when IC2 isn't installed

Some general cleanup
This commit is contained in:
malte0811 2017-08-23 22:30:24 +02:00
parent ccc3c7ab12
commit 840869cd08
13 changed files with 124 additions and 76 deletions

View file

@ -62,7 +62,7 @@ repositories {
} }
dependencies { dependencies {
deobfCompile 'net.industrial-craft:industrialcraft-2:2.8.+' compileOnly 'net.industrial-craft:industrialcraft-2:2.8.+'
deobfCompile "blusunrize:ImmersiveEngineering:0.12-+:deobf" deobfCompile "blusunrize:ImmersiveEngineering:0.12-+:deobf"
compileOnly "TechReborn:TechReborn-1.12:2.6.+:dev" compileOnly "TechReborn:TechReborn-1.12:2.6.+:dev"
compileOnly "RebornCore:RebornCore-1.12:3.2.+:dev" compileOnly "RebornCore:RebornCore-1.12:3.2.+:dev"

View file

@ -68,15 +68,21 @@ public class IndustrialWires {
public static final List<BlockIWBase> blocks = new ArrayList<>(); public static final List<BlockIWBase> blocks = new ArrayList<>();
public static final List<Item> items = new ArrayList<>(); public static final List<Item> items = new ArrayList<>();
public static BlockIC2Connector ic2conn; @GameRegistry.ObjectHolder(MODID+":"+BlockIC2Connector.NAME)
public static BlockMechanicalConverter mechConv; public static BlockIC2Connector ic2conn = null;
public static BlockJacobsLadder jacobsLadder; @GameRegistry.ObjectHolder(MODID+":"+BlockMechanicalConverter.NAME)
public static BlockPanel panel; public static BlockMechanicalConverter mechConv = null;
@GameRegistry.ObjectHolder(MODID+":"+BlockJacobsLadder.NAME)
public static BlockJacobsLadder jacobsLadder = null;
@GameRegistry.ObjectHolder(MODID+":"+BlockPanel.NAME)
public static BlockPanel panel = null;
@GameRegistry.ObjectHolder(MODID+":"+ItemIC2Coil.NAME)
public static ItemIC2Coil coil; public static ItemIC2Coil coil = null;
public static ItemPanelComponent panelComponent; @GameRegistry.ObjectHolder(MODID+":"+ItemPanelComponent.NAME)
public static ItemKey key; public static ItemPanelComponent panelComponent = null;
@GameRegistry.ObjectHolder(MODID+":"+ItemKey.ITEM_NAME)
public static ItemKey key = null;
public static final SimpleNetworkWrapper packetHandler = NetworkRegistry.INSTANCE.newSimpleChannel(MODID); public static final SimpleNetworkWrapper packetHandler = NetworkRegistry.INSTANCE.newSimpleChannel(MODID);
public static Logger logger; public static Logger logger;
@ -86,7 +92,11 @@ public class IndustrialWires {
@Override @Override
public ItemStack getTabIconItem() { public ItemStack getTabIconItem() {
return new ItemStack(coil, 1, 2); if (coil!=null) {
return new ItemStack(coil, 1, 2);
} else {
return new ItemStack(panel, 1, 3);
}
} }
}; };
@SidedProxy(clientSide = "malte0811.industrialWires.client.ClientProxy", serverSide = "malte0811.industrialWires.CommonProxy") @SidedProxy(clientSide = "malte0811.industrialWires.client.ClientProxy", serverSide = "malte0811.industrialWires.CommonProxy")
@ -100,21 +110,8 @@ public class IndustrialWires {
hasTechReborn = Loader.isModLoaded("techreborn"); hasTechReborn = Loader.isModLoaded("techreborn");
logger = e.getModLog(); logger = e.getModLog();
new IWConfig(); new IWConfig();
if (IWConfig.enableConversion&&hasIC2) {
mechConv = new BlockMechanicalConverter();
}
if (hasIC2||hasTechReborn) {
ic2conn = new BlockIC2Connector();
}
jacobsLadder = new BlockJacobsLadder();
panel = new BlockPanel();
coil = new ItemIC2Coil();
panelComponent = new ItemPanelComponent();
key = new ItemKey();
if (hasIC2) { if (hasIC2) {
//TODO
GameRegistry.registerTileEntity(TileEntityIC2ConnectorTin.class, MODID + ":ic2ConnectorTin"); GameRegistry.registerTileEntity(TileEntityIC2ConnectorTin.class, MODID + ":ic2ConnectorTin");
GameRegistry.registerTileEntity(TileEntityIC2ConnectorCopper.class, MODID + ":ic2ConnectorCopper"); GameRegistry.registerTileEntity(TileEntityIC2ConnectorCopper.class, MODID + ":ic2ConnectorCopper");
GameRegistry.registerTileEntity(TileEntityIC2ConnectorGold.class, MODID + ":ic2ConnectorGold"); GameRegistry.registerTileEntity(TileEntityIC2ConnectorGold.class, MODID + ":ic2ConnectorGold");
@ -144,9 +141,15 @@ public class IndustrialWires {
@SubscribeEvent @SubscribeEvent
public static void registerBlocks(RegistryEvent.Register<Block> event) { public static void registerBlocks(RegistryEvent.Register<Block> event) {
for (BlockIWBase b: blocks) {
event.getRegistry().register(b); if (IWConfig.enableConversion&&hasIC2) {
event.getRegistry().register(new BlockMechanicalConverter());
} }
if (hasIC2/*||hasTechReborn TODO talk to modmuss*/) {
event.getRegistry().register(new BlockIC2Connector());
}
event.getRegistry().register(new BlockJacobsLadder());
event.getRegistry().register(new BlockPanel());
} }
@SubscribeEvent @SubscribeEvent
@ -154,9 +157,12 @@ public class IndustrialWires {
for (BlockIWBase b:blocks) { for (BlockIWBase b:blocks) {
event.getRegistry().register(b.createItemBlock()); event.getRegistry().register(b.createItemBlock());
} }
for (Item i:items) {
event.getRegistry().register(i); if (hasIC2/*||hasTechReborn TODO talk to modmuss*/) {
event.getRegistry().register(new ItemIC2Coil());
} }
event.getRegistry().register(new ItemPanelComponent());
event.getRegistry().register(new ItemKey());
} }
@SubscribeEvent @SubscribeEvent

View file

@ -19,7 +19,6 @@
package malte0811.industrialWires.blocks; package malte0811.industrialWires.blocks;
import blusunrize.immersiveengineering.api.IEProperties; import blusunrize.immersiveengineering.api.IEProperties;
import malte0811.industrialWires.IndustrialWires;
import malte0811.industrialWires.blocks.TileEntityJacobsLadder.LadderSize; import malte0811.industrialWires.blocks.TileEntityJacobsLadder.LadderSize;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.IProperty;
@ -29,7 +28,6 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
@ -44,10 +42,11 @@ import net.minecraft.world.World;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
public class BlockJacobsLadder extends BlockIWBase implements IMetaEnum, IPlacementCheck { public class BlockJacobsLadder extends BlockIWBase implements IMetaEnum, IPlacementCheck {
public static final String NAME = "jacobs_ladder";
private static PropertyEnum<LadderSize> size_property = PropertyEnum.create("size", LadderSize.class); private static PropertyEnum<LadderSize> size_property = PropertyEnum.create("size", LadderSize.class);
public BlockJacobsLadder() { public BlockJacobsLadder() {
super(Material.IRON, "jacobs_ladder"); super(Material.IRON, NAME);
} }
@Nonnull @Nonnull
@ -176,6 +175,6 @@ public class BlockJacobsLadder extends BlockIWBase implements IMetaEnum, IPlacem
@Override @Override
public boolean rotateBlock(World world, @Nonnull BlockPos pos, @Nonnull EnumFacing axis) { public boolean rotateBlock(World world, @Nonnull BlockPos pos, @Nonnull EnumFacing axis) {
TileEntity te = world.getTileEntity(pos); TileEntity te = world.getTileEntity(pos);
return te instanceof TileEntityJacobsLadder && ((TileEntityJacobsLadder) te).rotate(world, pos, axis); return te instanceof TileEntityJacobsLadder && ((TileEntityJacobsLadder) te).rotate(world, pos);
} }
} }

View file

@ -49,10 +49,14 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.energy.CapabilityEnergy; import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.energy.IEnergyStorage; import net.minecraftforge.energy.IEnergyStorage;
import net.minecraftforge.fml.common.Optional;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import static malte0811.industrialWires.IndustrialWires.hasIC2;
@Optional.Interface(modid = "ic2", iface = "ic2.api.energy.tile.IEnergySink")
public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickable, IHasDummyBlocksIW, ISyncReceiver, IEnergySink, IBlockBoundsIW, IDirectionalTile { public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickable, IHasDummyBlocksIW, ISyncReceiver, IEnergySink, IBlockBoundsIW, IDirectionalTile {
public EnumFacing facing = EnumFacing.NORTH; public EnumFacing facing = EnumFacing.NORTH;
private DualEnergyStorage energy; private DualEnergyStorage energy;
@ -98,9 +102,8 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl
return; return;
} }
if (!world.isRemote) { if (!world.isRemote) {
if (!addedToIC2Net) { if (hasIC2&&!addedToIC2Net) {
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this)); addToIC2Net();
addedToIC2Net = true;
} }
if ((controlControls[0][0] == null || timeTillActive == -1 || t >= 1) && energy.getEnergyStoredEU() >= 2 * consumtionEU) { if ((controlControls[0][0] == null || timeTillActive == -1 || t >= 1) && energy.getEnergyStoredEU() >= 2 * consumtionEU) {
for (int j = 0; j < size.movementPoints; j++) { for (int j = 0; j < size.movementPoints; j++) {
@ -167,6 +170,12 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl
} }
} }
@Optional.Method(modid = "ic2")
private void addToIC2Net() {
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
addedToIC2Net = true;
}
private void initArc(int delay) { private void initArc(int delay) {
if (controlMovement == null) { if (controlMovement == null) {
initControl(); initControl();
@ -366,7 +375,7 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl
return false; return false;
} }
public boolean rotate(World world, BlockPos pos, EnumFacing axis) { public boolean rotate(World world, BlockPos pos) {
if (isActive()) { if (isActive()) {
return false; return false;
} }
@ -392,21 +401,25 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl
//ENERGY //ENERGY
@Override @Override
@Optional.Method(modid = "ic2")
public double getDemandedEnergy() { public double getDemandedEnergy() {
return energy.getEURequested(); return energy.getEURequested();
} }
@Override @Override
@Optional.Method(modid = "ic2")
public int getSinkTier() { public int getSinkTier() {
return 4; return 4;
} }
@Override @Override
@Optional.Method(modid = "ic2")
public double injectEnergy(EnumFacing dir, double amount, double voltage) { public double injectEnergy(EnumFacing dir, double amount, double voltage) {
return amount - energy.insertEU(amount, true); return amount - energy.insertEU(amount, true);
} }
@Override @Override
@Optional.Method(modid = "ic2")
public boolean acceptsEnergyFrom(IEnergyEmitter iEnergyEmitter, EnumFacing enumFacing) { public boolean acceptsEnergyFrom(IEnergyEmitter iEnergyEmitter, EnumFacing enumFacing) {
return !isDummy() && enumFacing == facing; return !isDummy() && enumFacing == facing;
} }
@ -429,17 +442,18 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl
@Override @Override
public void onChunkUnload() { public void onChunkUnload() {
if (!world.isRemote && addedToIC2Net) if (hasIC2) {
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); removeFromIC2Net();
}
addedToIC2Net = false; addedToIC2Net = false;
super.onChunkUnload(); super.onChunkUnload();
} }
@Override @Override
public void invalidate() { public void invalidate() {
if (!world.isRemote && addedToIC2Net) { if (hasIC2)
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); removeFromIC2Net();
} else if (world.isRemote) { if (world.isRemote) {
//stop sound //stop sound
IndustrialWires.proxy.playJacobsLadderSound(this, -1, soundPos); IndustrialWires.proxy.playJacobsLadderSound(this, -1, soundPos);
} }
@ -447,6 +461,14 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl
super.invalidate(); super.invalidate();
} }
@Optional.Method(modid = "ic2")
private void removeFromIC2Net() {
if (!world.isRemote && addedToIC2Net) {
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
}
}
@Nonnull @Nonnull
@Override @Override
public AxisAlignedBB getRenderBoundingBox() { public AxisAlignedBB getRenderBoundingBox() {

View file

@ -54,9 +54,10 @@ import java.util.List;
public class BlockPanel extends BlockIWBase implements IMetaEnum { public class BlockPanel extends BlockIWBase implements IMetaEnum {
public static final PropertyEnum<BlockTypes_Panel> type = PropertyEnum.create("type", BlockTypes_Panel.class); public static final PropertyEnum<BlockTypes_Panel> type = PropertyEnum.create("type", BlockTypes_Panel.class);
public static final String NAME = "control_panel";
public BlockPanel() { public BlockPanel() {
super(Material.IRON, "control_panel"); super(Material.IRON, NAME);
lightOpacity = 0; lightOpacity = 0;
} }

View file

@ -41,10 +41,11 @@ import net.minecraft.world.World;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
public class BlockMechanicalConverter extends BlockIWBase implements IMetaEnum { public class BlockMechanicalConverter extends BlockIWBase implements IMetaEnum {
public static final String NAME = "mechanical_converter";
private static PropertyEnum<MechanicalBlockType> type = PropertyEnum.create("type", MechanicalBlockType.class); private static PropertyEnum<MechanicalBlockType> type = PropertyEnum.create("type", MechanicalBlockType.class);
public BlockMechanicalConverter() { public BlockMechanicalConverter() {
super(Material.IRON, "mechanical_converter"); super(Material.IRON, NAME);
} }
@Override @Override

View file

@ -47,10 +47,11 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
public class BlockIC2Connector extends BlockIWBase implements IMetaEnum { public class BlockIC2Connector extends BlockIWBase implements IMetaEnum {
private static PropertyEnum<BlockTypes_IC2_Connector> type = PropertyEnum.create("type", BlockTypes_IC2_Connector.class); private static final PropertyEnum<BlockTypes_IC2_Connector> type = PropertyEnum.create("type", BlockTypes_IC2_Connector.class);
public static final String NAME = "ic2_connector";
public BlockIC2Connector() { public BlockIC2Connector() {
super(Material.IRON, "ic2_connector"); super(Material.IRON, NAME);
setHardness(3.0F); setHardness(3.0F);
setResistance(15.0F); setResistance(15.0F);
lightOpacity = 0; lightOpacity = 0;

View file

@ -21,6 +21,7 @@ import blusunrize.immersiveengineering.api.Lib;
import blusunrize.immersiveengineering.client.ClientUtils; import blusunrize.immersiveengineering.client.ClientUtils;
import blusunrize.immersiveengineering.common.util.ItemNBTHelper; import blusunrize.immersiveengineering.common.util.ItemNBTHelper;
import malte0811.industrialWires.IndustrialWires; import malte0811.industrialWires.IndustrialWires;
import malte0811.industrialWires.blocks.BlockIWBase;
import malte0811.industrialWires.blocks.IMetaEnum; import malte0811.industrialWires.blocks.IMetaEnum;
import malte0811.industrialWires.blocks.controlpanel.TileEntityPanel; import malte0811.industrialWires.blocks.controlpanel.TileEntityPanel;
import malte0811.industrialWires.client.panelmodel.PanelModel; import malte0811.industrialWires.client.panelmodel.PanelModel;
@ -116,10 +117,12 @@ public class ClientEventHandler {
} }
@SubscribeEvent @SubscribeEvent
public static void registerModels(ModelRegistryEvent evt) { public static void registerModels(ModelRegistryEvent evt) {
for (int meta = 0; meta < ItemIC2Coil.subNames.length; meta++) { if (IndustrialWires.coil!=null) {
ResourceLocation loc = new ResourceLocation(IndustrialWires.MODID, "ic2_wire_coil/" + ItemIC2Coil.subNames[meta]); for (int meta = 0; meta < ItemIC2Coil.subNames.length; meta++) {
ModelBakery.registerItemVariants(IndustrialWires.coil, loc); ResourceLocation loc = new ResourceLocation(IndustrialWires.MODID, "ic2_wire_coil/" + ItemIC2Coil.subNames[meta]);
ModelLoader.setCustomModelResourceLocation(IndustrialWires.coil, meta, new ModelResourceLocation(loc, "inventory")); ModelBakery.registerItemVariants(IndustrialWires.coil, loc);
ModelLoader.setCustomModelResourceLocation(IndustrialWires.coil, meta, new ModelResourceLocation(loc, "inventory"));
}
} }
for (int meta = 0; meta < ItemPanelComponent.types.length; meta++) { for (int meta = 0; meta < ItemPanelComponent.types.length; meta++) {
ResourceLocation loc = new ResourceLocation(IndustrialWires.MODID, "panel_component/" + ItemPanelComponent.types[meta]); ResourceLocation loc = new ResourceLocation(IndustrialWires.MODID, "panel_component/" + ItemPanelComponent.types[meta]);
@ -131,23 +134,19 @@ public class ClientEventHandler {
ModelBakery.registerItemVariants(IndustrialWires.key, loc); ModelBakery.registerItemVariants(IndustrialWires.key, loc);
ModelLoader.setCustomModelResourceLocation(IndustrialWires.key, meta, new ModelResourceLocation(loc, "inventory")); ModelLoader.setCustomModelResourceLocation(IndustrialWires.key, meta, new ModelResourceLocation(loc, "inventory"));
} }
for (BlockIWBase b : IndustrialWires.blocks) {
Block[] blocks = {IndustrialWires.ic2conn, IndustrialWires.mechConv, IndustrialWires.jacobsLadder, IndustrialWires.panel}; Item blockItem = Item.getItemFromBlock(b);
for (Block b : blocks) { final ResourceLocation loc = b.getRegistryName();
if (b != null) { assert loc != null;
Item blockItem = Item.getItemFromBlock(b); ModelLoader.setCustomMeshDefinition(blockItem, stack -> new ModelResourceLocation(loc, "inventory"));
final ResourceLocation loc = b.getRegistryName(); Object[] v = ((IMetaEnum) b).getValues();
assert loc != null; for (int meta = 0; meta < v.length; meta++) {
ModelLoader.setCustomMeshDefinition(blockItem, stack -> new ModelResourceLocation(loc, "inventory")); String location = loc.toString();
Object[] v = ((IMetaEnum) b).getValues(); String prop = "inventory,type=" + v[meta].toString().toLowerCase(Locale.US);
for (int meta = 0; meta < v.length; meta++) { try {
String location = loc.toString(); ModelLoader.setCustomModelResourceLocation(blockItem, meta, new ModelResourceLocation(location, prop));
String prop = "inventory,type=" + v[meta].toString().toLowerCase(Locale.US); } catch (NullPointerException npe) {
try { throw new RuntimeException(b + " lacks an item!", npe);
ModelLoader.setCustomModelResourceLocation(blockItem, meta, new ModelResourceLocation(location, prop));
} catch (NullPointerException npe) {
throw new RuntimeException(b + " lacks an item!", npe);
}
} }
} }
} }

View file

@ -1,5 +1,6 @@
package malte0811.industrialWires.crafting; package malte0811.industrialWires.crafting;
import blusunrize.immersiveengineering.api.ApiUtils;
import blusunrize.immersiveengineering.common.IEContent; import blusunrize.immersiveengineering.common.IEContent;
import ic2.api.item.IC2Items; import ic2.api.item.IC2Items;
import malte0811.industrialWires.IndustrialWires; import malte0811.industrialWires.IndustrialWires;
@ -17,21 +18,24 @@ import java.util.Set;
public final class IC2TRHelper { public final class IC2TRHelper {
public static Ingredient getStack(String type, String variant) { public static Ingredient getStack(String type, String variant) {
Set<ItemStack> stacks = new HashSet<>(); Set<ItemStack> stacks = new HashSet<>();
if (type.equals("crafting")&&variant.equals("rubber")) {
if (ApiUtils.isExistingOreName("itemRubber")) {
return new OreIngredient("itemRubber");
}
}
if (IndustrialWires.hasIC2) { if (IndustrialWires.hasIC2) {
stacks.add(IC2Items.getItem(type, variant)); stacks.add(IC2Items.getItem(type, variant));
} }
if (Loader.isModLoaded("techreborn")) { if (IndustrialWires.hasTechReborn) {
switch (type) { switch (type) {
case "cable": case "cable":
stacks.add(getTRCable(variant)); stacks.add(getTRCable(variant));
break; break;
case "crafting": case "crafting":
switch (variant) { switch (variant) {
case "coil":
stacks.add(new ItemStack(IEContent.blockMetalDecoration0));
break;
case "alloy": case "alloy":
stacks.add(TechRebornAPI.subItemRetriever.getPlateByName("advanced_alloy")); stacks.add(TechRebornAPI.subItemRetriever.getPlateByName("advanced_alloy"));
break;
} }
break; break;
case "te": case "te":
@ -47,10 +51,17 @@ public final class IC2TRHelper {
return getIECable(variant.substring("type:".length(), variant.indexOf(','))); return getIECable(variant.substring("type:".length(), variant.indexOf(',')));
case "crafting": case "crafting":
switch (variant) { switch (variant) {
case "coil":
stacks.add(new ItemStack(IEContent.blockMetalDecoration0));
break;
case "alloy": case "alloy":
return new OreIngredient("plateConstantan"); return new OreIngredient("plateConstantan");
case "electric_motor": case "electric_motor":
stacks.add(new ItemStack(IEContent.itemMaterial, 1, 27)); stacks.add(new ItemStack(IEContent.itemMaterial, 1, 27));
break;
case "rubber":
stacks.add(new ItemStack(IEContent.itemMaterial, 1, 13));
break;
} }
break; break;
case "te": case "te":
@ -59,6 +70,9 @@ public final class IC2TRHelper {
} }
} }
} }
if (stacks.size()==0) {
IndustrialWires.logger.info("No ingredient found for "+type+", "+variant);
}
return Ingredient.fromStacks(stacks.toArray(new ItemStack[stacks.size()])); return Ingredient.fromStacks(stacks.toArray(new ItemStack[stacks.size()]));
} }

View file

@ -55,13 +55,14 @@ import java.util.Set;
public class ItemIC2Coil extends Item implements IWireCoil { public class ItemIC2Coil extends Item implements IWireCoil {
public final static String[] subNames = {"tin", "copper", "gold", "hv", "glass"}; public final static String[] subNames = {"tin", "copper", "gold", "hv", "glass"};
public final static String lengthKey = "wireLength"; public final static String lengthKey = "wireLength";
public final static String NAME = "ic2_wire_coil";
public ItemIC2Coil() { public ItemIC2Coil() {
setUnlocalizedName(IndustrialWires.MODID + ".ic2_wire_coil"); setUnlocalizedName(IndustrialWires.MODID + "."+NAME);
setHasSubtypes(true); setHasSubtypes(true);
this.setCreativeTab(IndustrialWires.creativeTab); this.setCreativeTab(IndustrialWires.creativeTab);
setMaxStackSize(64); setMaxStackSize(64);
setRegistryName(new ResourceLocation(IndustrialWires.MODID, "ic2_wire_coil")); setRegistryName(new ResourceLocation(IndustrialWires.MODID, NAME));
IndustrialWires.items.add(this); IndustrialWires.items.add(this);
} }

View file

@ -42,13 +42,14 @@ public class ItemKey extends Item implements INetGUIItem {
public static final String RING_KEYS = "ringkeys"; public static final String RING_KEYS = "ringkeys";
public static final String NAME = "name"; public static final String NAME = "name";
public static final String[] types = {"blank_key", "key", "key_ring"}; public static final String[] types = {"blank_key", "key", "key_ring"};
public static final String ITEM_NAME = "key";
public ItemKey() { public ItemKey() {
setUnlocalizedName(IndustrialWires.MODID + ".key"); setUnlocalizedName(IndustrialWires.MODID + "."+ITEM_NAME);
setHasSubtypes(true); setHasSubtypes(true);
this.setCreativeTab(IndustrialWires.creativeTab); this.setCreativeTab(IndustrialWires.creativeTab);
setMaxStackSize(64); setMaxStackSize(64);
setRegistryName(new ResourceLocation(IndustrialWires.MODID, "key")); setRegistryName(new ResourceLocation(IndustrialWires.MODID, ITEM_NAME));
IndustrialWires.items.add(this); IndustrialWires.items.add(this);
} }

View file

@ -60,13 +60,14 @@ public class ItemPanelComponent extends Item implements INetGUIItem {
public static final String TYPE = "type"; public static final String TYPE = "type";
public static final String ID = "cfgId"; public static final String ID = "cfgId";
public static final String VALUE = "value"; public static final String VALUE = "value";
public static final String NAME = "panel_component";
public ItemPanelComponent() { public ItemPanelComponent() {
setUnlocalizedName(IndustrialWires.MODID + ".panel_component"); setUnlocalizedName(IndustrialWires.MODID + "."+NAME);
setHasSubtypes(true); setHasSubtypes(true);
this.setCreativeTab(IndustrialWires.creativeTab); this.setCreativeTab(IndustrialWires.creativeTab);
setMaxStackSize(64); setMaxStackSize(64);
setRegistryName(new ResourceLocation(IndustrialWires.MODID, "panel_component")); setRegistryName(new ResourceLocation(IndustrialWires.MODID, NAME));
IndustrialWires.items.add(this); IndustrialWires.items.add(this);
} }

View file

@ -11,7 +11,9 @@
"type": "forge:ore_shaped", "type": "forge:ore_shaped",
"key": { "key": {
"r": { "r": {
"type": "forge:ore_dict", "ore": "itemRubber" "type": "industrialwires:ic2_item",
"name": "crafting",
"variant": "rubber"
}, },
"c": { "c": {
"type": "industrialwires:ic2_item", "type": "industrialwires:ic2_item",