Some minor work on the mixer

This commit is contained in:
Calclavia 2014-01-25 22:28:05 +08:00
parent 1c3898bd9e
commit 497d566bfa
8 changed files with 27 additions and 17 deletions

View file

@ -21,7 +21,7 @@ import resonantinduction.archaic.imprint.TileImprinter;
import resonantinduction.core.Reference; import resonantinduction.core.Reference;
import resonantinduction.core.ResonantInduction; import resonantinduction.core.ResonantInduction;
import resonantinduction.core.Settings; import resonantinduction.core.Settings;
import resonantinduction.core.part.BlockMachinePart; import resonantinduction.core.part.BlockMachineMaterial;
import calclavia.lib.content.ContentRegistry; import calclavia.lib.content.ContentRegistry;
import calclavia.lib.network.PacketHandler; import calclavia.lib.network.PacketHandler;
import calclavia.lib.prefab.item.ItemBlockMetadata; import calclavia.lib.prefab.item.ItemBlockMetadata;
@ -87,7 +87,7 @@ public class Archaic
blockFirebox = contentRegistry.createTile(BlockFirebox.class, TileFirebox.class); blockFirebox = contentRegistry.createTile(BlockFirebox.class, TileFirebox.class);
blockHotPlate = contentRegistry.createBlock(BlockHotPlate.class, ItemBlockMetadata.class, TileHotPlate.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); itemImprint = contentRegistry.createItem(ItemBlockImprint.class);
itemHammer = contentRegistry.createItem(ItemHammer.class); itemHammer = contentRegistry.createItem(ItemHammer.class);

View file

@ -15,16 +15,22 @@ import resonantinduction.core.prefab.block.BlockBase;
* @author Calclavia * @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" }; 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]; Icon[] icons = new Icon[iconNames.length];
public BlockMachinePart() public BlockMachineMaterial()
{ {
super("material"); super("material");
} }
@Override
public int damageDropped(int par1)
{
return par1;
}
@Override @Override
public Icon getIcon(int side, int metadata) public Icon getIcon(int side, int metadata)
{ {

View file

@ -76,10 +76,10 @@ public class ResourceGenerator
// Add rubble to crushing recipes // Add rubble to crushing recipes
// TODO: Change this to CRUSHING when the crusher is finished. // 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. // 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);
} }
} }
} }

View file

@ -15,7 +15,7 @@ import resonantinduction.core.Reference;
import resonantinduction.core.ResonantInduction; import resonantinduction.core.ResonantInduction;
import resonantinduction.core.ResonantInductionTabs; import resonantinduction.core.ResonantInductionTabs;
import resonantinduction.core.Settings; import resonantinduction.core.Settings;
import resonantinduction.core.part.BlockMachinePart; import resonantinduction.core.part.BlockMachineMaterial;
import resonantinduction.electrical.armbot.BlockArmbot; import resonantinduction.electrical.armbot.BlockArmbot;
import resonantinduction.electrical.armbot.TileArmbot; import resonantinduction.electrical.armbot.TileArmbot;
import resonantinduction.electrical.battery.BlockBattery; import resonantinduction.electrical.battery.BlockBattery;

View file

@ -4,6 +4,7 @@ import net.minecraft.block.ITileEntityProvider;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
import resonantinduction.core.Reference;
import resonantinduction.core.Settings; import resonantinduction.core.Settings;
import resonantinduction.core.prefab.block.BlockRIRotatable; import resonantinduction.core.prefab.block.BlockRIRotatable;
import resonantinduction.mechanical.process.TileMixer; import resonantinduction.mechanical.process.TileMixer;
@ -20,6 +21,7 @@ public class BlockMixer extends BlockRIRotatable implements ITileEntityProvider
public BlockMixer() public BlockMixer()
{ {
super("mixer", Settings.getNextBlockID()); super("mixer", Settings.getNextBlockID());
setTextureName(Reference.PREFIX + "material_metal_top");
} }
@Override @Override

View file

@ -58,7 +58,7 @@ public class BlockGrinderWheel extends BlockRIRotatable implements ITileEntityPr
if (!TileGrinderWheel.timer.containsKey((EntityItem) entity)) if (!TileGrinderWheel.timer.containsKey((EntityItem) entity))
{ {
TileGrinderWheel.timer.put((EntityItem) entity, TileGrinderWheel.DEFAULT_TIME); TileGrinderWheel.timer.put((EntityItem) entity, TileGrinderWheel.PROCESS_TIME);
} }
} }
else else

View file

@ -25,14 +25,13 @@ import cpw.mods.fml.relauncher.Side;
*/ */
public class TileGrinderWheel extends TileMechanical implements IRotatable public class TileGrinderWheel extends TileMechanical implements IRotatable
{ {
public static final long POWER = 500000; public static final int PROCESS_TIME = 20 * 20;
public static final int DEFAULT_TIME = 20 * 20;
/** A map of ItemStacks and their remaining grind-time left. */ /** A map of ItemStacks and their remaining grind-time left. */
public static final Timer<EntityItem> timer = new Timer<EntityItem>(); public static final Timer<EntityItem> timer = new Timer<EntityItem>();
public EntityItem grindingItem = null; public EntityItem grindingItem = null;
private final long requiredTorque = 1000; private final long requiredTorque = 2000;
private long counter = 0; private long counter = 0;
@Override @Override
@ -79,7 +78,7 @@ public class TileGrinderWheel extends TileMechanical implements IRotatable
{ {
grindingItem.setEntityItemStack(grindingItem.getEntityItem()); grindingItem.setEntityItemStack(grindingItem.getEntityItem());
// Reset timer // Reset timer
timer.put(grindingItem, DEFAULT_TIME); timer.put(grindingItem, PROCESS_TIME);
} }
} }
} }

View file

@ -26,8 +26,10 @@ import universalelectricity.api.vector.Vector3;
public class TileMixer extends TileMechanical public class TileMixer extends TileMechanical
{ {
public static final long POWER = 500000; 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<EntityItem> timer = new Timer<EntityItem>(); public static final Timer<EntityItem> timer = new Timer<EntityItem>();
private final long requiredTorque = 1000;
private long counter = 0;
@Override @Override
public void updateEntity() public void updateEntity()
@ -36,6 +38,7 @@ public class TileMixer extends TileMechanical
if (canWork()) if (canWork())
{ {
counter = Math.max(counter + torque, 0);
doWork(); doWork();
} }
} }
@ -47,7 +50,7 @@ public class TileMixer extends TileMechanical
*/ */
public boolean canWork() public boolean canWork()
{ {
return true; return counter >= requiredTorque;
} }
public void doWork() public void doWork()
@ -105,7 +108,7 @@ public class TileMixer extends TileMechanical
{ {
if (!timer.containsKey(processingItem)) 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) 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()); processingItem.setEntityItemStack(processingItem.getEntityItem());
// Reset timer // Reset timer
timer.put(processingItem, DEFAULT_TIME); timer.put(processingItem, PROCESS_TIME);
} }
} }
} }