Item icespike = new ItemStaff(mod_Dragon.LAST_ID++, "Ice Spike", Block.ice.blockID, false) {
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityLiving e) {
// ep.setItemInUse(itemstack, getMaxItemUseDuration(itemstack));
if (!(e instanceof EntityPlayer))
return itemstack;
EntityPlayer ep = (EntityPlayer) e;
float f = 1.0F;
double d = ep.prevPosX + (ep.posX - ep.prevPosX) * (double) f;
double d1 = (ep.prevPosY + (ep.posY - ep.prevPosY) * (double) f + 1.62D)
- (double) ep.yOffset;
double d2 = ep.prevPosZ + (ep.posZ - ep.prevPosZ) * (double) f;
boolean flag = false;
MovingObjectPosition movingobjectposition = getMovingObjectPositionFromPlayer(
world, ep, flag);
if (movingobjectposition == null)
return itemstack;
if (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE) {
int i = movingobjectposition.blockX;
int j = movingobjectposition.blockY;
int k = movingobjectposition.blockZ;
if (movingobjectposition.sideHit == 0)
j--;
if (movingobjectposition.sideHit == 1)
j++;
if (movingobjectposition.sideHit == 2)
k--;
if (movingobjectposition.sideHit == 3)
k++;
if (movingobjectposition.sideHit == 4)
i--;
if (movingobjectposition.sideHit == 5)
i++;
if (!ep.canPlayerEdit(i, j, k))
return itemstack;
if (world.isAirBlock(i, j, k) || !world.getBlockMaterial(i, j, k).isSolid())
Magic.Destruction.icespike(world, i, j, k);
}
return itemstack;