use of net.minecraft.entity.EntityLivingBase in project ArsMagica2 by Mithion.
the class ItemBoundHoe method onUpdate.
@Override
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int slotIndex, boolean par5) {
if (par3Entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) par3Entity;
if (player.capabilities.isCreativeMode)
return;
ExtendedProperties props = ExtendedProperties.For(player);
if (props.getCurrentMana() + props.getBonusCurrentMana() < this.maintainCost()) {
UnbindItem(par1ItemStack, (EntityPlayer) par3Entity, slotIndex);
return;
} else {
props.deductMana(this.maintainCost());
}
if (par1ItemStack.getItemDamage() > 0)
par1ItemStack.damageItem(-1, (EntityLivingBase) par3Entity);
}
}
use of net.minecraft.entity.EntityLivingBase in project ArsMagica2 by Mithion.
the class ItemBoundPickaxe method onUpdate.
@Override
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int slotIndex, boolean par5) {
if (par3Entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) par3Entity;
if (player.capabilities.isCreativeMode)
return;
ExtendedProperties props = ExtendedProperties.For(player);
if (props.getCurrentMana() + props.getBonusCurrentMana() < this.maintainCost()) {
UnbindItem(par1ItemStack, (EntityPlayer) par3Entity, slotIndex);
return;
} else {
props.deductMana(this.maintainCost());
}
if (par1ItemStack.getItemDamage() > 0)
par1ItemStack.damageItem(-1, (EntityLivingBase) par3Entity);
}
}
use of net.minecraft.entity.EntityLivingBase in project ArsMagica2 by Mithion.
the class ItemBoundShovel method onUpdate.
@Override
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int slotIndex, boolean par5) {
if (par3Entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) par3Entity;
if (player.capabilities.isCreativeMode)
return;
ExtendedProperties props = ExtendedProperties.For(player);
if (props.getCurrentMana() + props.getBonusCurrentMana() < this.maintainCost()) {
UnbindItem(par1ItemStack, (EntityPlayer) par3Entity, slotIndex);
return;
} else {
props.deductMana(this.maintainCost());
}
if (par1ItemStack.getItemDamage() > 0)
par1ItemStack.damageItem(-1, (EntityLivingBase) par3Entity);
}
}
use of net.minecraft.entity.EntityLivingBase in project ArsMagica2 by Mithion.
the class ItemBoundSword method onUpdate.
@Override
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int slotIndex, boolean par5) {
if (par3Entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) par3Entity;
if (player.capabilities.isCreativeMode)
return;
ExtendedProperties props = ExtendedProperties.For(player);
if (props.getCurrentMana() + props.getBonusCurrentMana() < this.maintainCost()) {
UnbindItem(par1ItemStack, (EntityPlayer) par3Entity, slotIndex);
return;
} else {
props.deductMana(this.maintainCost());
}
if (par1ItemStack.getItemDamage() > 0)
par1ItemStack.damageItem(-1, (EntityLivingBase) par3Entity);
}
}
use of net.minecraft.entity.EntityLivingBase in project ArsMagica2 by Mithion.
the class AffinityData method onAffinityAbility.
public void onAffinityAbility() {
if (getAffinityDepth(Affinity.ENDER) >= 0.75) {
if (this.entity.isSneaking()) {
this.hasActivatedNightVision = !this.hasActivatedNightVision;
} else {
if (this.lastGroundPosition != null) {
if (positionIsValid(lastGroundPosition)) {
spawnParticlesAt(lastGroundPosition);
spawnParticlesAt(new AMVector3(entity));
this.entity.setPosition(this.lastGroundPosition.x, this.lastGroundPosition.y + 1, this.lastGroundPosition.z);
ExtendedProperties.For((EntityLivingBase) this.entity).setFallProtection(20000);
this.entity.worldObj.playSoundEffect(entity.posX, entity.posY, entity.posZ, "mob.endermen.portal", 1.0F, 1.0F);
this.setCooldown(AMCore.config.getEnderAffinityAbilityCooldown());
} else {
((EntityPlayer) this.entity).addChatMessage(new ChatComponentText("am2.affinity.enderTPFailed"));
}
} else {
((EntityPlayer) this.entity).addChatMessage(new ChatComponentText("am2.affinity.enderTPFailed"));
}
}
}
//beyond here we can handle other affinities that have activatable abilities
}
Aggregations