mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-20 04:09:43 +00:00
Add IToolHammer to Yeta wrench so it can wrench TE machines.
This commit is contained in:
1 parent
59d7506e5f
commit
182fead64d
4 files changed
+83
-7
No files matched your search
@@ -0,0 +1,44 @@
|
||||
package cofh.api.item;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
* Implement this interface on subclasses of Item to have that item work as a tool for CoFH mods.
|
||||
*/
|
||||
public interface IToolHammer {
|
||||
|
||||
/**
|
||||
* Called to ensure that the wrench can be used.
|
||||
*
|
||||
* @param item
|
||||
* The itemstack for the tool. Not required to match equipped item (e.g., multi-tools that contain other tools)
|
||||
* @param user
|
||||
* The entity using the tool
|
||||
* @param x
|
||||
* X location of the block/tile
|
||||
* @param y
|
||||
* Y location of the block/tile
|
||||
* @param z
|
||||
* Z location of the block/tile
|
||||
* @return True if this tool can be used
|
||||
*/
|
||||
boolean isUsable(ItemStack item, EntityLivingBase user, int x, int y, int z);
|
||||
|
||||
/**
|
||||
* Callback for when the tool has been used reactively.
|
||||
*
|
||||
* @param item
|
||||
* The ItemStack for the tool. Not required to match equipped item (e.g., multi-tools that contain other tools)
|
||||
* @param user
|
||||
* The entity using the tool
|
||||
* @param x
|
||||
* X location of the block/tile
|
||||
* @param y
|
||||
* Y location of the block/tile
|
||||
* @param z
|
||||
* Z location of the block/tile
|
||||
*/
|
||||
void toolUsed(ItemStack item, EntityLivingBase user, int x, int y, int z);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* (C) 2014 Team CoFH / CoFH / Cult of the Full Hub
|
||||
* http://www.teamcofh.com
|
||||
*/
|
||||
@API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHAPI", provides = "CoFHAPI|item")
|
||||
package cofh.api.item;
|
||||
|
||||
import cofh.api.CoFHAPIProps;
|
||||
import cpw.mods.fml.common.API;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package crazypants.enderio.item;
|
||||
|
||||
import cofh.api.item.IToolHammer;
|
||||
import buildcraft.api.tools.IToolWrench;
|
||||
|
||||
public interface IYetaWrench extends IToolWrench, IToolHammer{
|
||||
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
package crazypants.enderio.item;
|
||||
|
||||
import cofh.api.item.IToolHammer;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -18,7 +20,7 @@ import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.gui.IResourceTooltipProvider;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
|
||||
public class ItemYetaWrench extends Item implements IToolWrench, IResourceTooltipProvider {
|
||||
public class ItemYetaWrench extends Item implements IYetaWrench, IResourceTooltipProvider {
|
||||
|
||||
public static ItemYetaWrench create() {
|
||||
if(Config.useSneakMouseWheelYetaWrench) {
|
||||
@@ -71,7 +73,14 @@ public class ItemYetaWrench extends Item implements IToolWrench, IResourceToolti
|
||||
ConduitDisplayMode.setDisplayMode(equipped, newMode);
|
||||
return equipped;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFull3D() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* IYetaWrench */
|
||||
|
||||
@Override
|
||||
public boolean canWrench(EntityPlayer player, int x, int y, int z) {
|
||||
return true;
|
||||
@@ -86,15 +95,20 @@ public class ItemYetaWrench extends Item implements IToolWrench, IResourceToolti
|
||||
public boolean doesSneakBypassUse(World world, int x, int y, int z, EntityPlayer player) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUsable(ItemStack item, EntityLivingBase user, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toolUsed(ItemStack item, EntityLivingBase user, int x, int y, int z) {
|
||||
;
|
||||
}
|
||||
|
||||
/* IResourceTooltipProvider */
|
||||
@Override
|
||||
public String getUnlocalizedNameForTooltip(ItemStack stack) {
|
||||
return getUnlocalizedName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFull3D() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user