diff --git a/src/main/java/resonantinduction/electrical/Electrical.java b/src/main/java/resonantinduction/electrical/Electrical.java index b8636da5..e73cabc3 100644 --- a/src/main/java/resonantinduction/electrical/Electrical.java +++ b/src/main/java/resonantinduction/electrical/Electrical.java @@ -128,8 +128,8 @@ public class Electrical Settings.save(); OreDictionary.registerOre("wire", itemPartWire); - OreDictionary.registerOre("battery", blockBattery); - OreDictionary.registerOre("batteryBox", blockBattery); + OreDictionary.registerOre("battery", ItemBlockBattery.setTier(new ItemStack(blockBattery, 1, 0), (byte) 0)); + OreDictionary.registerOre("batteryBox", ItemBlockBattery.setTier(new ItemStack(blockBattery, 1, 0), (byte) 0)); /** * Set reference itemstacks @@ -167,9 +167,9 @@ public class Electrical GameRegistry.addRecipe(new ShapedOreRecipe(itemMultimeter, "WWW", "ICI", 'W', defaultWire, 'C', UniversalRecipe.BATTERY.get(), 'I', UniversalRecipe.PRIMARY_METAL.get())); /** Battery */ - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockBattery, 1, 0), "III", "IRI", "III", 'R', Block.blockRedstone, 'I', UniversalRecipe.PRIMARY_METAL.get())); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockBattery, 1, 1), "RRR", "RIR", "RRR", 'R', ItemBlockBattery.getTier(new ItemStack(blockBattery, 1, 0)), 'I', UniversalRecipe.PRIMARY_PLATE.get())); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(blockBattery, 1, 2), "RRR", "RIR", "RRR", 'R', ItemBlockBattery.getTier(new ItemStack(blockBattery, 1, 1)), 'I', Block.blockDiamond)); + GameRegistry.addRecipe(new ShapedOreRecipe(ItemBlockBattery.setTier(new ItemStack(blockBattery, 1, 0), (byte) 0), "III", "IRI", "III", 'R', Block.blockRedstone, 'I', UniversalRecipe.PRIMARY_METAL.get())); + GameRegistry.addRecipe(new ShapedOreRecipe(ItemBlockBattery.setTier(new ItemStack(blockBattery, 1, 0), (byte) 1), "RRR", "RIR", "RRR", 'R', ItemBlockBattery.setTier(new ItemStack(blockBattery, 1, 0), (byte) 1), 'I', UniversalRecipe.PRIMARY_PLATE.get())); + GameRegistry.addRecipe(new ShapedOreRecipe(ItemBlockBattery.setTier(new ItemStack(blockBattery, 1, 0), (byte) 2), "RRR", "RIR", "RRR", 'R', ItemBlockBattery.setTier(new ItemStack(blockBattery, 1, 0), (byte) 0), 'I', Block.blockDiamond)); /** Wires **/ GameRegistry.addRecipe(new ShapedOreRecipe(EnumWireMaterial.COPPER.getWire(3), "MMM", 'M', "ingotCopper")); @@ -186,7 +186,7 @@ public class Electrical /** Generators **/ GameRegistry.addRecipe(new ShapedOreRecipe(blockSolarPanel, "CCC", "WWW", "III", 'W', defaultWire, 'C', Item.coal, 'I', UniversalRecipe.PRIMARY_METAL.get())); - GameRegistry.addRecipe(new ShapedOreRecipe(blockGenerator, "SRS", "SMS", "SWS", 'W', defaultWire, 'M', UniversalRecipe.MOTOR.get(), 'S', UniversalRecipe.PRIMARY_METAL.get())); + GameRegistry.addRecipe(new ShapedOreRecipe(blockGenerator, "SRS", "SMS", "SWS", 'W', defaultWire, 'R', Item.redstone, 'M', UniversalRecipe.MOTOR.get(), 'S', UniversalRecipe.PRIMARY_METAL.get())); GameRegistry.addRecipe(new ShapedOreRecipe(blockThermopile, "ORO", "OWO", "OOO", 'W', defaultWire, 'O', Block.obsidian, 'R', Item.redstone)); /** Wire Compatiblity **/ diff --git a/src/main/java/resonantinduction/electrical/battery/ItemBlockBattery.java b/src/main/java/resonantinduction/electrical/battery/ItemBlockBattery.java index 16bd39a1..5f422395 100644 --- a/src/main/java/resonantinduction/electrical/battery/ItemBlockBattery.java +++ b/src/main/java/resonantinduction/electrical/battery/ItemBlockBattery.java @@ -126,7 +126,7 @@ public class ItemBlockBattery extends ItemBlock implements IEnergyItem, IVoltage return energyStored; } - public ItemStack setTier(ItemStack itemStack, byte tier) + public static ItemStack setTier(ItemStack itemStack, byte tier) { if (itemStack.getTagCompound() == null) { diff --git a/src/main/java/resonantinduction/mechanical/Mechanical.java b/src/main/java/resonantinduction/mechanical/Mechanical.java index c2e4c38c..58583785 100644 --- a/src/main/java/resonantinduction/mechanical/Mechanical.java +++ b/src/main/java/resonantinduction/mechanical/Mechanical.java @@ -144,7 +144,7 @@ public class Mechanical GameRegistry.addRecipe(new ShapedOreRecipe(blockTank, "GGG", "GSG", "GGG", 'G', Block.glass, 'S', Item.ingotIron)); GameRegistry.addRecipe(new ShapedOreRecipe(blockGrate, "BBB", "B B", "BBB", 'B', Block.fenceIron)); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemPipe, 4), "BBB", "GGG", "BBB", 'B', UniversalRecipe.SECONDARY_METAL.get())); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemPipe, 4), "BBB", " ", "BBB", 'B', UniversalRecipe.SECONDARY_METAL.get())); GameRegistry.addRecipe(new ShapedOreRecipe(itemPipeGuage, "RRR", "GGG", " S ", 'S', Item.stick, 'G', Block.glass, 'R', Item.redstone)); GameRegistry.addRecipe(new ShapedOreRecipe(blockGrinderWheel, "III", "LGL", "III", 'I', UniversalRecipe.PRIMARY_METAL.get(), 'L', "logWood", 'G', itemGear)); diff --git a/src/main/java/resonantinduction/mechanical/gear/PartGear.java b/src/main/java/resonantinduction/mechanical/gear/PartGear.java index df988a1a..d017381e 100644 --- a/src/main/java/resonantinduction/mechanical/gear/PartGear.java +++ b/src/main/java/resonantinduction/mechanical/gear/PartGear.java @@ -45,12 +45,12 @@ public class PartGear extends PartMechanical implements IMechanical, IMultiBlock { if (angularVelocity > 0) { - torque += 1; + torque += 10; angularVelocity += 0.1f; } else { - torque -= 1; + torque -= 10; angularVelocity -= 0.1f; } @@ -84,7 +84,7 @@ public class PartGear extends PartMechanical implements IMechanical, IMultiBlock { if (!world().isRemote) { - System.out.println(getNetwork()); + // System.out.println(this + ":" + getNetwork()); // for(Object obj : connections) // System.out.println(obj); } @@ -152,6 +152,7 @@ public class PartGear extends PartMechanical implements IMechanical, IMultiBlock } + // TODO: Make bending with large gears work. if (!getMultiBlock().isConstructed()) { /** Look for gears that are internal and adjacent to this gear. (The 4 sides) */ diff --git a/src/main/java/resonantinduction/mechanical/network/MechanicalNetwork.java b/src/main/java/resonantinduction/mechanical/network/MechanicalNetwork.java index 9b449711..d3ad5803 100644 --- a/src/main/java/resonantinduction/mechanical/network/MechanicalNetwork.java +++ b/src/main/java/resonantinduction/mechanical/network/MechanicalNetwork.java @@ -113,7 +113,9 @@ public class MechanicalNetwork extends Network public void reconstruct() { super.reconstruct(); - NetworkTickHandler.addNetwork(this); + + if (canUpdate()) + NetworkTickHandler.addNetwork(this); } @Override @@ -122,25 +124,6 @@ public class MechanicalNetwork extends Network connector.setNetwork(this); } - /** Segmented out call so overriding can be done when machines are reconstructed. */ - protected void reconstructHandler(Object obj, ForgeDirection side) - { - if (obj != null && !(obj instanceof IMechanical)) - { - if (obj instanceof IMechanical) - { - EnumSet set = this.handlerDirectionMap.get(obj); - if (set == null) - { - set = EnumSet.noneOf(ForgeDirection.class); - } - this.getConnectors().add((IMechanical) obj); - set.add(side); - this.handlerDirectionMap.put(obj, set); - } - } - } - @Override public float getRotation(float velocity) { diff --git a/src/main/java/resonantinduction/mechanical/network/PartMechanical.java b/src/main/java/resonantinduction/mechanical/network/PartMechanical.java index d76f56e5..b1301a02 100644 --- a/src/main/java/resonantinduction/mechanical/network/PartMechanical.java +++ b/src/main/java/resonantinduction/mechanical/network/PartMechanical.java @@ -71,17 +71,15 @@ public abstract class PartMechanical extends JCuboidPart implements JNormalOcclu @Override public void update() { - if (ticks == 0) - { - getNetwork().addConnector(this); - } - + // TODO: Fix gear network somehow tick while network is invalid. + getNetwork().addConnector(this); + ticks++; angle += angularVelocity / 20; if (!world().isRemote) checkClientUpdate(); - + super.update(); } @@ -255,18 +253,19 @@ public abstract class PartMechanical extends JCuboidPart implements JNormalOcclu @Override public IMechanicalNetwork getNetwork() { - if (this.network == null) + if (network == null) { - this.network = new MechanicalNetwork(); - this.network.addConnector(this); + network = new MechanicalNetwork(); + network.addConnector(this); } - return this.network; + + return network; } @Override public void setNetwork(IMechanicalNetwork network) { - this.network = network; + network = network; } @Override