}
public static ArrayList<Item> staves = new ArrayList<Item>();
public static void addStaves() {
Item mageLight = new ItemStaff(mod_Dragon.LAST_ID++, "Magelight", Block.glowStone.blockID,
false) {
public StaffEntity getFireball(World world, final EntityLiving ep, float f) {
StaffEntity e = new StaffEntity(world, ep, f * 2.0F) {
public void onLoad() {
int duration = (int) Math.min(Alteration.playerLevel.get(ep), 20);
Magic.Alteration.mageList(worldObj, this, duration, ep);
}
};
e.particletype = "spell";
return e;
}
public void updateMagic(EntityLiving el) {
if (Alteration.playerSkill.containsKey(el))
Alteration.playerSkill.put(el, Alteration.playerSkill.get(el) + 1);
else
Alteration.playerSkill.put(el, 1);
}
};
Item atronach = new ItemStaff(mod_Dragon.LAST_ID++, "Atronach", Item.blazeRod.shiftedIndex,
true) {
public StaffEntity getFireball(World world, final EntityLiving ep, float f) {
StaffEntity e = new StaffEntity(world, ep, f * 2.0F) {
public void onCollide() {
Magic.Conjuration
.summonCreature(worldObj, Atronach.class, posX, posY, posZ,
(int) Math.max(Magic.Conjuration.playerLevel.get(ep), 60),
ep);
}
};
e.particletype = "flame";
return e;
}
public void updateMagic(EntityLiving el) {
if (Conjuration.playerSkill.containsKey(el))
Conjuration.playerSkill.put(el, Conjuration.playerSkill.get(el) + 1);
else
Conjuration.playerSkill.put(el, 1);
}
};
Item fireball = new ItemStaff(mod_Dragon.LAST_ID++, "Fireball",
Item.fireballCharge.shiftedIndex, true) {
public StaffEntity getFireball(World world, final EntityLiving ep, float f) {
StaffEntity e = new StaffEntity(world, ep, f * 2.0F) {
public void onCollide() {
Magic.Destruction.fireball(worldObj, posX, posY, posZ);
}
};
e.particletype = "flame";
return e;
}
};
Item iceball = new ItemStaff(mod_Dragon.LAST_ID++, "Ice Blast", Item.snowball.shiftedIndex,
true) {
public StaffEntity getFireball(World world, final EntityLiving ep, float f) {
StaffEntity e = new StaffEntity(world, ep, f * 2.0F) {
public void onCollide() {
Magic.Destruction.iceball(worldObj, posX, posY, posZ);
}
};
e.particletype = "splash";
return e;
}
};
Item firebolt = new ItemStaff(mod_Dragon.LAST_ID++, "Firebolt",
Item.flintAndSteel.shiftedIndex, true) {
public StaffEntity getFireball(World world, final EntityLiving ep, float f) {
StaffEntity e = new StaffEntity(world, ep, f * 2.0F) {
public void onCollide() {
if (collided != null)
Magic.Destruction.firebolt(ep, collided);
}
};
e.particletype = "flame";
return e;
}
public void updateMagic(EntityLiving el) {
if (Destruction.playerSkill.containsKey(el))
Destruction.playerSkill.put(el, Destruction.playerSkill.get(el) + 1);
else
Destruction.playerSkill.put(el, 1);
}
};
Item icebolt = new ItemStaff(mod_Dragon.LAST_ID++, "Ice Bolt", Block.blockSnow.blockID,
false) {
public StaffEntity getFireball(World world, final EntityLiving ep, float f) {
StaffEntity e = new StaffEntity(world, ep, f * 2.0F) {
public void onCollide() {
if (collided != null)
Magic.Destruction.icebolt(ep, collided);
}
};
e.particletype = "splash";
return e;
}
public void updateMagic(EntityLiving el) {
if (Destruction.playerSkill.containsKey(el))
Destruction.playerSkill.put(el, Destruction.playerSkill.get(el) + 1);
else
Destruction.playerSkill.put(el, 1);
}
};
Item lightningbolt = new ItemStaff(mod_Dragon.LAST_ID++, "Lightning Bolt",
Item.redstone.shiftedIndex, true) {
public StaffEntity getFireball(World world, final EntityLiving ep, float f) {
StaffEntity e = new StaffEntity(world, ep, f * 2.0F) {
public void onCollide() {
if (collided != null)
Magic.Destruction.lightningbolt(ep, collided);
}
};
e.particletype = "reddust";
return e;
}
public void updateMagic(EntityLiving el) {
if (Destruction.playerSkill.containsKey(el))
Destruction.playerSkill.put(el, Destruction.playerSkill.get(el) + 1);
else
Destruction.playerSkill.put(el, 1);
}
};
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;
}
};
Item healing = new ItemStaff(mod_Dragon.LAST_ID++, "Heal", Item.appleRed.shiftedIndex, true) {
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityLiving ep) {
Restoration.heal(world, ep, world.rand);
itemstack.damageItem(2, ep);
for(int x = 0; x < 10; x++)
world.spawnParticle("heart", ep.posX, ep.posY, ep.posZ, 0, 0, 0);
return itemstack;
}
public void updateMagic(EntityLiving el) {
if (Restoration.playerSkill.containsKey(el))
Restoration.playerSkill.put(el, Restoration.playerSkill.get(el) + 1);
else
Restoration.playerSkill.put(el, 1);
}
};
Item necro = new ItemStaff(mod_Dragon.LAST_ID++, "Raise Undead",
Item.rottenFlesh.shiftedIndex, true) {
public StaffEntity getFireball(World world, final EntityLiving ep, float f) {
StaffEntity e = new StaffEntity(world, ep, f * 2.0F) {
public void onCollide() {
Magic.Conjuration.summonNecro(worldObj, posX, posY, posZ, ep, null);