Millstone and gear now requires hand crank

This commit is contained in:
Calclavia 2014-02-25 23:21:43 +08:00
parent 4f101e97e2
commit f96ee359b2
7 changed files with 34 additions and 24 deletions

View file

@ -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)
{

View file

@ -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));

View file

@ -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);
}
}

View file

@ -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())

View file

@ -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;
}

View file

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB