2013-07-26 21:18:53 -07:00
|
|
|
package tconstruct.items.tools;
|
|
|
|
|
|
2014-09-12 23:56:05 +10:00
|
|
|
import cpw.mods.fml.common.FMLCommonHandler;
|
2014-09-09 18:30:15 +10:00
|
|
|
import cpw.mods.fml.relauncher.*;
|
2014-09-10 01:35:06 +10:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
|
import net.minecraft.item.*;
|
|
|
|
|
import net.minecraft.world.World;
|
2014-09-12 23:56:05 +10:00
|
|
|
import tconstruct.TConstruct;
|
2013-07-26 21:18:53 -07:00
|
|
|
import tconstruct.library.tools.Weapon;
|
2014-09-12 23:56:05 +10:00
|
|
|
import tconstruct.tools.*;
|
2014-09-10 01:35:06 +10:00
|
|
|
import tconstruct.tools.logic.EquipLogic;
|
2013-07-26 21:18:53 -07:00
|
|
|
|
|
|
|
|
public class BattleSign extends Weapon
|
|
|
|
|
{
|
2013-12-31 16:37:46 -05:00
|
|
|
public BattleSign()
|
2013-07-26 21:18:53 -07:00
|
|
|
{
|
2013-12-31 16:37:46 -05:00
|
|
|
super(1);
|
2013-07-26 21:18:53 -07:00
|
|
|
this.setUnlocalizedName("InfiTool.Battlesign");
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-17 00:31:43 -05:00
|
|
|
@Override
|
2013-07-26 21:18:53 -07:00
|
|
|
public String getToolName ()
|
|
|
|
|
{
|
|
|
|
|
return "Battlesign";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Item getHeadItem ()
|
|
|
|
|
{
|
2014-06-04 21:44:48 -08:00
|
|
|
return TinkerTools.signHead;
|
2013-07-26 21:18:53 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Item getAccessoryItem ()
|
|
|
|
|
{
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
|
@Override
|
|
|
|
|
public int getRenderPasses (int metadata)
|
|
|
|
|
{
|
|
|
|
|
return 8;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int getPartAmount ()
|
|
|
|
|
{
|
|
|
|
|
return 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void registerPartPaths (int index, String[] location)
|
|
|
|
|
{
|
|
|
|
|
headStrings.put(index, location[0]);
|
|
|
|
|
brokenPartStrings.put(index, location[1]);
|
|
|
|
|
handleStrings.put(index, location[2]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String getIconSuffix (int partType)
|
|
|
|
|
{
|
|
|
|
|
switch (partType)
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
return "_battlesign_head";
|
|
|
|
|
case 1:
|
|
|
|
|
return "_battlesign_head_broken";
|
|
|
|
|
case 2:
|
|
|
|
|
return "_battlesign_handle";
|
|
|
|
|
default:
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String getEffectSuffix ()
|
|
|
|
|
{
|
|
|
|
|
return "_battlesign_effect";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String getDefaultFolder ()
|
|
|
|
|
{
|
|
|
|
|
return "battlesign";
|
|
|
|
|
}
|
2014-09-10 01:35:06 +10:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float clickX, float clickY, float clickZ)
|
|
|
|
|
{
|
|
|
|
|
if (side == 0 || !player.isSneaking())
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else if (!world.getBlock(x, y, z).getMaterial().isSolid())
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (side == 1)
|
|
|
|
|
{
|
|
|
|
|
++y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (side == 2)
|
|
|
|
|
{
|
|
|
|
|
--z;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (side == 3)
|
|
|
|
|
{
|
|
|
|
|
++z;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (side == 4)
|
|
|
|
|
{
|
|
|
|
|
--x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (side == 5)
|
|
|
|
|
{
|
|
|
|
|
++x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!player.canPlayerEdit(x, y, z, side, stack))
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else if (!TinkerTools.battlesignBlock.canPlaceBlockAt(world, x, y, z))
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
world.setBlock(x, y, z, TinkerTools.battlesignBlock, 0, 3);
|
|
|
|
|
TinkerTools.battlesignBlock.onBlockPlacedBy(world, x, y, z, player, stack);
|
|
|
|
|
|
|
|
|
|
EquipLogic logic = (EquipLogic) world.getTileEntity(x, y, z);
|
|
|
|
|
logic.setEquipmentItem(stack);
|
|
|
|
|
--stack.stackSize;
|
|
|
|
|
|
2014-09-12 23:56:05 +10:00
|
|
|
if (FMLCommonHandler.instance().getSide() == Side.CLIENT)
|
|
|
|
|
{
|
|
|
|
|
player.openGui(TConstruct.instance, ToolProxyClient.battlesignTextID, world, x, y, z);
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-10 01:35:06 +10:00
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-07-26 21:18:53 -07:00
|
|
|
}
|