diff --git a/archaic/src/main/java/resonantinduction/archaic/process/BlockMillstone.java b/archaic/src/main/java/resonantinduction/archaic/process/BlockMillstone.java index 0c78ad93..dd42a193 100644 --- a/archaic/src/main/java/resonantinduction/archaic/process/BlockMillstone.java +++ b/archaic/src/main/java/resonantinduction/archaic/process/BlockMillstone.java @@ -9,6 +9,7 @@ import net.minecraft.util.Icon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import resonantinduction.core.Reference; +import resonantinduction.mechanical.gear.ItemHandCrank; import universalelectricity.api.vector.Vector3; import calclavia.lib.prefab.block.BlockTile; import calclavia.lib.utility.inventory.InventoryUtility; @@ -87,9 +88,18 @@ public class BlockMillstone extends BlockTile { TileMillstone tile = (TileMillstone) te; ItemStack current = player.inventory.getCurrentItem(); - ItemStack output = tile.getStackInSlot(0); + if (current != null && current.getItem() instanceof ItemHandCrank) + { + if (output != null) + { + tile.doGrind(new Vector3(player)); + player.addExhaustion(0.3f); + return true; + } + } + if (output != null) { InventoryUtility.dropItemStack(world, new Vector3(player), output, 0); @@ -107,27 +117,6 @@ public class BlockMillstone extends BlockTile return false; } - @Override - public boolean onUseWrench(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) - { - TileEntity te = world.getBlockTileEntity(x, y, z); - - if (te instanceof TileMillstone) - { - TileMillstone tile = (TileMillstone) te; - ItemStack output = tile.getStackInSlot(0); - - if (output != null) - { - tile.doGrind(new Vector3(entityPlayer)); - entityPlayer.addExhaustion(0.3f); - return true; - } - } - - return false; - } - @Override public TileEntity createNewTileEntity(World var1) { diff --git a/mechanical/src/main/java/resonantinduction/mechanical/Mechanical.java b/mechanical/src/main/java/resonantinduction/mechanical/Mechanical.java index 332329b2..6d8255be 100644 --- a/mechanical/src/main/java/resonantinduction/mechanical/Mechanical.java +++ b/mechanical/src/main/java/resonantinduction/mechanical/Mechanical.java @@ -23,6 +23,7 @@ import resonantinduction.mechanical.fluid.transport.TileGrate; import resonantinduction.mechanical.fluid.transport.TilePump; import resonantinduction.mechanical.gear.ItemGear; import resonantinduction.mechanical.gear.ItemGearShaft; +import resonantinduction.mechanical.gear.ItemHandCrank; import resonantinduction.mechanical.item.ItemPipeGauge; import resonantinduction.mechanical.logistic.belt.BlockDetector; import resonantinduction.mechanical.logistic.belt.BlockManipulator; @@ -81,6 +82,7 @@ public class Mechanical public static final ContentRegistry contentRegistry = new ContentRegistry(Settings.CONFIGURATION, Settings.idManager, ID).setPrefix(Reference.PREFIX).setTab(TabRI.CORE); // Energy + public static Item itemHandCrank; public static Item itemGear; public static Item itemGearShaft; public static Block windTurbine; @@ -115,6 +117,7 @@ public class Mechanical NetworkRegistry.instance().registerGuiHandler(this, proxy); MinecraftForge.EVENT_BUS.register(new MicroblockHighlightHandler()); + itemHandCrank = contentRegistry.createItem(ItemHandCrank.class); itemGear = contentRegistry.createItem(ItemGear.class); itemGearShaft = contentRegistry.createItem(ItemGearShaft.class); windTurbine = contentRegistry.createTile(BlockWindTurbine.class, TileWindTurbine.class); @@ -159,6 +162,7 @@ public class Mechanical public void postInit(FMLPostInitializationEvent evt) { // Add recipes + GameRegistry.addRecipe(new ShapedOreRecipe(itemHandCrank, "S ", "SSS", " S", 'S', Item.stick)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemGear, 1, 0), "SWS", "W W", "SWS", 'W', "plankWood", 'S', Item.stick)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemGear, 1, 1), " W ", "WGW", " W ", 'G', new ItemStack(itemGear, 1, 0), 'W', Block.cobblestone)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(itemGear, 1, 2), " W ", "WGW", " W ", 'G', new ItemStack(itemGear, 1, 1), 'W', Item.ingotIron)); diff --git a/mechanical/src/main/java/resonantinduction/mechanical/gear/ItemHandCrank.java b/mechanical/src/main/java/resonantinduction/mechanical/gear/ItemHandCrank.java new file mode 100644 index 00000000..0a67a955 --- /dev/null +++ b/mechanical/src/main/java/resonantinduction/mechanical/gear/ItemHandCrank.java @@ -0,0 +1,14 @@ +package resonantinduction.mechanical.gear; + +import net.minecraft.block.Block; +import net.minecraft.item.EnumToolMaterial; +import net.minecraft.item.Item; + +public class ItemHandCrank extends Item +{ + public ItemHandCrank(int id) + { + super(id); + } + +} diff --git a/mechanical/src/main/java/resonantinduction/mechanical/gear/PartGear.java b/mechanical/src/main/java/resonantinduction/mechanical/gear/PartGear.java index b212b058..c9bcb3c8 100644 --- a/mechanical/src/main/java/resonantinduction/mechanical/gear/PartGear.java +++ b/mechanical/src/main/java/resonantinduction/mechanical/gear/PartGear.java @@ -117,7 +117,7 @@ public class PartGear extends PartMechanical implements IMechanical, IMultiBlock @Override public boolean activate(EntityPlayer player, MovingObjectPosition hit, ItemStack item) { - if (WrenchUtility.isUsableWrench(player, player.getCurrentEquippedItem(), x(), y(), z())) + if (item != null && item.getItem() instanceof ItemHandCrank) { if (player.isSneaking()) { @@ -138,7 +138,6 @@ public class PartGear extends PartMechanical implements IMechanical, IMultiBlock player.addExhaustion(0.01f); } - WrenchUtility.damageWrench(player, player.getCurrentEquippedItem(), x(), y(), z()); return true; } else if (player.isSneaking()) diff --git a/src/main/java/resonantinduction/api/recipe/MachineRecipes.java b/src/main/java/resonantinduction/api/recipe/MachineRecipes.java index d03d95b2..1eb2a04b 100644 --- a/src/main/java/resonantinduction/api/recipe/MachineRecipes.java +++ b/src/main/java/resonantinduction/api/recipe/MachineRecipes.java @@ -42,6 +42,9 @@ public final class MachineRecipes if (obj instanceof FluidStack) return new FluidStackResource((FluidStack) obj); + if (obj instanceof RecipeResource) + return (RecipeResource) obj; + return null; } diff --git a/src/main/resources/assets/resonantinduction/languages/en_US.properties b/src/main/resources/assets/resonantinduction/languages/en_US.properties index c451b727..15a3de6f 100644 --- a/src/main/resources/assets/resonantinduction/languages/en_US.properties +++ b/src/main/resources/assets/resonantinduction/languages/en_US.properties @@ -17,6 +17,7 @@ item.resonantinduction\:oreDust.name=%v Dust item.resonantinduction\:oreDust.tooltip=Shift-right click on a cauldron to refine. item.resonantinduction\:oreRefinedDust.name=%v Refined Dust item.resonantinduction\:oreRubble.name=%v Rubble +item.resonantinduction\:handCrank.name=Hand Crank ### Archaic Module ## machineMaterials diff --git a/src/main/resources/assets/resonantinduction/textures/items/handCrank.png b/src/main/resources/assets/resonantinduction/textures/items/handCrank.png new file mode 100644 index 00000000..ac1da0c0 Binary files /dev/null and b/src/main/resources/assets/resonantinduction/textures/items/handCrank.png differ