-
-
Save izzyaxel/4ea3eabdb22f24574a87 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ItemCrownOfIris extends ItemArmor implements ISpecialArmor | |
{ | |
public ItemCrownOfIris(ArmorMaterial armormat, int renderIndex, int slot) | |
{ | |
super(armormat, renderIndex, slot); | |
this.setUnlocalizedName("crownOfIris"); | |
this.setTextureName(AAReference.MODID + ":" + getUnlocalizedName().substring(5)); | |
this.setMaxStackSize(1); | |
this.setCreativeTab(AACreativeTab.aaTab); | |
AAItemDespawnHandler.registerItemToNeverDespawn(this); | |
MinecraftForge.EVENT_BUS.register(this); | |
} | |
@Override | |
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) | |
{ | |
return AAReference.MODID + ":textures/models/armor/crownOfIris.png"; | |
} | |
@Override | |
public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) {} | |
@Override | |
public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) | |
{ | |
return new ArmorProperties(1000, 1000, 1000); | |
} | |
@Override | |
public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) | |
{ | |
return 0; | |
} | |
@SubscribeEvent(receiveCanceled = true) | |
public void onDamage(LivingHurtEvent event) | |
{ | |
if(event.entityLiving instanceof EntityPlayer) | |
{ | |
EntityPlayer player = (EntityPlayer)event.entityLiving; | |
AAExtendedPlayer props = (AAExtendedPlayer)player.getExtendedProperties(AAExtendedPlayer.EEPName); | |
if(props.hasCrown()) | |
{ | |
for(int i = 0; i < (int)event.ammount * 4; i++) | |
{ | |
if(!event.entity.worldObj.isRemote) | |
{ | |
ArcaneArtificing.snw.sendToAllAround(new MessageDoParticles(AAReference.CrownRainbowFX, player.posX + ((itemRand.nextInt(3) - 1) * itemRand.nextFloat()), player.posY + 1.5 + ((itemRand.nextInt(3) - 1) * itemRand.nextFloat()), player.posZ + ((itemRand.nextInt(3) - 1) * itemRand.nextFloat()), 0, 0, 0, 40f, 20), new NetworkRegistry.TargetPoint(player.dimension, player.posX, player.posY, player.posZ, 256)); | |
} | |
} | |
event.ammount = 0; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment