From 497d566bfaeab043719662d4458260b01341bfc9 Mon Sep 17 00:00:00 2001 From: Calclavia Date: Sat, 25 Jan 2014 22:28:05 +0800 Subject: [PATCH] Some minor work on the mixer --- src/main/java/resonantinduction/archaic/Archaic.java | 4 ++-- ...lockMachinePart.java => BlockMachineMaterial.java} | 10 ++++++++-- .../core/resource/ResourceGenerator.java | 4 ++-- .../java/resonantinduction/electrical/Electrical.java | 2 +- .../electrical/purifier/BlockMixer.java | 2 ++ .../mechanical/process/BlockGrinderWheel.java | 2 +- .../mechanical/process/TileGrinderWheel.java | 9 ++++----- .../mechanical/process/TileMixer.java | 11 +++++++---- 8 files changed, 27 insertions(+), 17 deletions(-) rename src/main/java/resonantinduction/core/part/{BlockMachinePart.java => BlockMachineMaterial.java} (90%) diff --git a/src/main/java/resonantinduction/archaic/Archaic.java b/src/main/java/resonantinduction/archaic/Archaic.java index 158723181..46196921b 100644 --- a/src/main/java/resonantinduction/archaic/Archaic.java +++ b/src/main/java/resonantinduction/archaic/Archaic.java @@ -21,7 +21,7 @@ import resonantinduction.archaic.imprint.TileImprinter; import resonantinduction.core.Reference; import resonantinduction.core.ResonantInduction; import resonantinduction.core.Settings; -import resonantinduction.core.part.BlockMachinePart; +import resonantinduction.core.part.BlockMachineMaterial; import calclavia.lib.content.ContentRegistry; import calclavia.lib.network.PacketHandler; import calclavia.lib.prefab.item.ItemBlockMetadata; @@ -87,7 +87,7 @@ public class Archaic blockFirebox = contentRegistry.createTile(BlockFirebox.class, TileFirebox.class); blockHotPlate = contentRegistry.createBlock(BlockHotPlate.class, ItemBlockMetadata.class, TileHotPlate.class); - blockMachinePart = contentRegistry.createBlock(BlockMachinePart.class, ItemBlockMetadata.class); + blockMachinePart = contentRegistry.createBlock(BlockMachineMaterial.class, ItemBlockMetadata.class); itemImprint = contentRegistry.createItem(ItemBlockImprint.class); itemHammer = contentRegistry.createItem(ItemHammer.class); diff --git a/src/main/java/resonantinduction/core/part/BlockMachinePart.java b/src/main/java/resonantinduction/core/part/BlockMachineMaterial.java similarity index 90% rename from src/main/java/resonantinduction/core/part/BlockMachinePart.java rename to src/main/java/resonantinduction/core/part/BlockMachineMaterial.java index b852287fe..689b17849 100644 --- a/src/main/java/resonantinduction/core/part/BlockMachinePart.java +++ b/src/main/java/resonantinduction/core/part/BlockMachineMaterial.java @@ -15,16 +15,22 @@ import resonantinduction.core.prefab.block.BlockBase; * @author Calclavia * */ -public class BlockMachinePart extends BlockBase +public class BlockMachineMaterial extends BlockBase { String[] iconNames = new String[] { "material_metal_side", "material_metal_top", "material_stone_brick", "material_stone_brick2", "material_stone_chiseled", "material_stone_cobble", "material_stone_cracked", "material_stone", "material_stone_slab", "material_stone_mossy", "material_steel_dark", "material_steel_tint", "material_steel" }; Icon[] icons = new Icon[iconNames.length]; - public BlockMachinePart() + public BlockMachineMaterial() { super("material"); } + @Override + public int damageDropped(int par1) + { + return par1; + } + @Override public Icon getIcon(int side, int metadata) { diff --git a/src/main/java/resonantinduction/core/resource/ResourceGenerator.java b/src/main/java/resonantinduction/core/resource/ResourceGenerator.java index bbab2e119..c20a8e649 100644 --- a/src/main/java/resonantinduction/core/resource/ResourceGenerator.java +++ b/src/main/java/resonantinduction/core/resource/ResourceGenerator.java @@ -76,10 +76,10 @@ public class ResourceGenerator // Add rubble to crushing recipes // TODO: Change this to CRUSHING when the crusher is finished. - MachineRecipes.INSTANCE.addRecipe(RecipeType.GRINDER, "ore" + name, "rubble" + name, "rubble" + name); + MachineRecipes.INSTANCE.addRecipe(RecipeType.GRINDER, "ore" + name, "dust" + name, "dust" + name); // Add dust to mixer recipes, dummy item because mixer doesn't produce any items. - MachineRecipes.INSTANCE.addRecipe(RecipeType.MIXER, "rubble" + name, "dust" + name); + MachineRecipes.INSTANCE.addRecipe(RecipeType.MIXER, "dust" + name, "dustRefined" + name); } } } diff --git a/src/main/java/resonantinduction/electrical/Electrical.java b/src/main/java/resonantinduction/electrical/Electrical.java index ef274a4eb..3c55bf790 100644 --- a/src/main/java/resonantinduction/electrical/Electrical.java +++ b/src/main/java/resonantinduction/electrical/Electrical.java @@ -15,7 +15,7 @@ import resonantinduction.core.Reference; import resonantinduction.core.ResonantInduction; import resonantinduction.core.ResonantInductionTabs; import resonantinduction.core.Settings; -import resonantinduction.core.part.BlockMachinePart; +import resonantinduction.core.part.BlockMachineMaterial; import resonantinduction.electrical.armbot.BlockArmbot; import resonantinduction.electrical.armbot.TileArmbot; import resonantinduction.electrical.battery.BlockBattery; diff --git a/src/main/java/resonantinduction/electrical/purifier/BlockMixer.java b/src/main/java/resonantinduction/electrical/purifier/BlockMixer.java index a1113e840..3e912bd4a 100644 --- a/src/main/java/resonantinduction/electrical/purifier/BlockMixer.java +++ b/src/main/java/resonantinduction/electrical/purifier/BlockMixer.java @@ -4,6 +4,7 @@ import net.minecraft.block.ITileEntityProvider; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.ForgeDirection; +import resonantinduction.core.Reference; import resonantinduction.core.Settings; import resonantinduction.core.prefab.block.BlockRIRotatable; import resonantinduction.mechanical.process.TileMixer; @@ -20,6 +21,7 @@ public class BlockMixer extends BlockRIRotatable implements ITileEntityProvider public BlockMixer() { super("mixer", Settings.getNextBlockID()); + setTextureName(Reference.PREFIX + "material_metal_top"); } @Override diff --git a/src/main/java/resonantinduction/mechanical/process/BlockGrinderWheel.java b/src/main/java/resonantinduction/mechanical/process/BlockGrinderWheel.java index 7659bf44b..ca6757cc8 100644 --- a/src/main/java/resonantinduction/mechanical/process/BlockGrinderWheel.java +++ b/src/main/java/resonantinduction/mechanical/process/BlockGrinderWheel.java @@ -58,7 +58,7 @@ public class BlockGrinderWheel extends BlockRIRotatable implements ITileEntityPr if (!TileGrinderWheel.timer.containsKey((EntityItem) entity)) { - TileGrinderWheel.timer.put((EntityItem) entity, TileGrinderWheel.DEFAULT_TIME); + TileGrinderWheel.timer.put((EntityItem) entity, TileGrinderWheel.PROCESS_TIME); } } else diff --git a/src/main/java/resonantinduction/mechanical/process/TileGrinderWheel.java b/src/main/java/resonantinduction/mechanical/process/TileGrinderWheel.java index 7cd373630..71c3d4adc 100644 --- a/src/main/java/resonantinduction/mechanical/process/TileGrinderWheel.java +++ b/src/main/java/resonantinduction/mechanical/process/TileGrinderWheel.java @@ -25,14 +25,13 @@ import cpw.mods.fml.relauncher.Side; */ public class TileGrinderWheel extends TileMechanical implements IRotatable { - public static final long POWER = 500000; - public static final int DEFAULT_TIME = 20 * 20; + public static final int PROCESS_TIME = 20 * 20; /** A map of ItemStacks and their remaining grind-time left. */ public static final Timer timer = new Timer(); public EntityItem grindingItem = null; - - private final long requiredTorque = 1000; + + private final long requiredTorque = 2000; private long counter = 0; @Override @@ -79,7 +78,7 @@ public class TileGrinderWheel extends TileMechanical implements IRotatable { grindingItem.setEntityItemStack(grindingItem.getEntityItem()); // Reset timer - timer.put(grindingItem, DEFAULT_TIME); + timer.put(grindingItem, PROCESS_TIME); } } } diff --git a/src/main/java/resonantinduction/mechanical/process/TileMixer.java b/src/main/java/resonantinduction/mechanical/process/TileMixer.java index 79f306e51..94f6a5ac3 100644 --- a/src/main/java/resonantinduction/mechanical/process/TileMixer.java +++ b/src/main/java/resonantinduction/mechanical/process/TileMixer.java @@ -26,8 +26,10 @@ import universalelectricity.api.vector.Vector3; public class TileMixer extends TileMechanical { public static final long POWER = 500000; - public static final int DEFAULT_TIME = 5 * 20; + public static final int PROCESS_TIME = 5 * 20; public static final Timer timer = new Timer(); + private final long requiredTorque = 1000; + private long counter = 0; @Override public void updateEntity() @@ -36,6 +38,7 @@ public class TileMixer extends TileMechanical if (canWork()) { + counter = Math.max(counter + torque, 0); doWork(); } } @@ -47,7 +50,7 @@ public class TileMixer extends TileMechanical */ public boolean canWork() { - return true; + return counter >= requiredTorque; } public void doWork() @@ -105,7 +108,7 @@ public class TileMixer extends TileMechanical { if (!timer.containsKey(processingItem)) { - timer.put(processingItem, DEFAULT_TIME); + timer.put(processingItem, PROCESS_TIME); } if (!processingItem.isDead && new Vector3(this).add(0.5).distance(processingItem) < 2) @@ -126,7 +129,7 @@ public class TileMixer extends TileMechanical { processingItem.setEntityItemStack(processingItem.getEntityItem()); // Reset timer - timer.put(processingItem, DEFAULT_TIME); + timer.put(processingItem, PROCESS_TIME); } } }