Use given variables to condense code
This commit is contained in:
parent
e8c86a8c92
commit
578051b530
13 changed files with 27 additions and 74 deletions
|
|
@ -3,7 +3,6 @@ package mysticworld.items;
|
|||
import mysticworld.MysticWorld;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
|
|
@ -16,13 +15,6 @@ public class ItemOrbFire extends ItemOrb {
|
|||
super(id);
|
||||
}
|
||||
|
||||
public boolean itemInteractionForEntity(ItemStack itemStack, EntityLiving entityLiving) {
|
||||
entityLiving.setFire(5);
|
||||
entityLiving.attackEntityFrom(DamageSource.magic, 7);
|
||||
itemStack.damageItem(1, entityLiving);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) {
|
||||
if (par7 == 0) {
|
||||
|
|
@ -66,14 +58,9 @@ public class ItemOrbFire extends ItemOrb {
|
|||
@Override
|
||||
public void onUpdate(ItemStack itemStack, World world, Entity entity, int par4, boolean par5) {
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
ItemStack currentItem = player.inventory.getCurrentItem();
|
||||
if (!world.isRemote) {
|
||||
if (currentItem != null) {
|
||||
if (currentItem.itemID == itemStack.itemID) {
|
||||
player.addPotionEffect(new PotionEffect(Potion.fireResistance.getId(), 20, 0));
|
||||
MysticWorld.proxy.fireFX(world, (player.posX - 0.5D) + rand.nextDouble(), player.posY, (player.posZ - 0.5D) + rand.nextDouble(), 1.0F);
|
||||
}
|
||||
}
|
||||
if (!world.isRemote && par5) {
|
||||
player.addPotionEffect(new PotionEffect(Potion.fireResistance.getId(), 20, 0));
|
||||
MysticWorld.proxy.fireFX(world, (player.posX - 0.5D) + rand.nextDouble(), player.posY, (player.posZ - 0.5D) + rand.nextDouble(), 1.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue