From f96ee359b2ebd3a0a03236944b3826cb19f56f9a Mon Sep 17 00:00:00 2001 From: Calclavia Date: Tue, 25 Feb 2014 23:21:43 +0800 Subject: [PATCH] Millstone and gear now requires hand crank --- .../archaic/process/BlockMillstone.java | 33 ++++++------------ .../mechanical/Mechanical.java | 4 +++ .../mechanical/gear/ItemHandCrank.java | 14 ++++++++ .../mechanical/gear/PartGear.java | 3 +- .../api/recipe/MachineRecipes.java | 3 ++ .../languages/en_US.properties | 1 + .../textures/items/handCrank.png | Bin 0 -> 1149 bytes 7 files changed, 34 insertions(+), 24 deletions(-) create mode 100644 mechanical/src/main/java/resonantinduction/mechanical/gear/ItemHandCrank.java create mode 100644 src/main/resources/assets/resonantinduction/textures/items/handCrank.png diff --git a/archaic/src/main/java/resonantinduction/archaic/process/BlockMillstone.java b/archaic/src/main/java/resonantinduction/archaic/process/BlockMillstone.java index 0c78ad93e..dd42a1934 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 332329b23..6d8255be2 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 000000000..0a67a9556 --- /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 b212b0584..c9bcb3c8d 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 d03d95b2f..1eb2a04b8 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 c451b7277..15a3de6ff 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 0000000000000000000000000000000000000000..ac1da0c0e02792b6b5604c5e93d80501ffc42387 GIT binary patch literal 1149 zcmV-@1cLjCP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D02*{fSaefwW^{L9 za%BKeVQFr3E>1;MAa*k@H7+qRNAp5A000B*NkltC-?hx zlSopMB9TM6hg_1aNK$fp;Y}$aPF^J9>Euy554F}`z*`I~$bk^dE^F`PJ!E{ckZq_D71N=r-q6c-muNlA&6mzV3D5wHjPhr(%e zL4wN4N~x%*km~AcDJv_}>)Rc5~ zcIr4hJnSE_u@0G;nd(PHa&mHfA>DbLM##?2mV$x;EoV(ljV337K|)K)$hub$;_(Fz z5g6YHGLRGpOW4-droUfaUgVD-KfXNTOC_$aua(-`TB)n6^QHKl@6!bG^76EFmYnfV z-?o2zZ2tVI3BEE~HB11>i5r;D|063aOZ#St2?U&G&$kT`|N1cdSFnnJRU{=PMbgsJ zd?^D2a8aP8r9}mJojDOA{`wGcb8{1ttE(%&kNFdeHbO!|f?EKWg^OcO-XIp3D*XK+ zf@+0=z4&-z7|F@WT7@71IPx8%*6TzdZ}6QD5!?x{-Gzw&ViG$hCdMrwBO^l}5OV-d z;tEVV&U~z_tjOBhnsbj~EiqzaV4rNSR5!w02SaKyuH22!^4AITwKW6 z*_j+39?HhXhQA{Ak{QeiXqStTq_k#ma8NorI;5wkM_+7<-yewm5V=_HGts@r^`uqE3WMo7J1_pFa&q>_X z)#X1q!UFSsngA!Iq)$&za({m>ySuxxx3{MP4h{}vdwW}!mX>68c2-49PEN|i#Dtcc z#GDv0%)7h0m8Pa9eS*Ivz@Q31N$K_0)|Tw-?D$_l`_E^7eqQG0=2Q@Wf)T-~X_w*s z?gMcefyCBV;K5m4U6swv%})ZnAcP9gdoCyKw7U}+-*6gT*hTYxUd*xEw~ZYeodd!->-vPMpT@A>aN3i#G7YJ>tn_ P00000NkvXXu0mjfVV4yw literal 0 HcmV?d00001