Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.rbs.slurpiesdongles.armor;
- import com.rbs.slurpiesdongles.SlurpiesDongles;
- import com.rbs.slurpiesdongles.init.SlurpiesDonglesItems;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.inventory.EntityEquipmentSlot;
- import net.minecraft.item.ItemArmor;
- import net.minecraft.item.ItemStack;
- import net.minecraft.potion.Potion;
- import net.minecraft.potion.PotionEffect;
- import net.minecraft.world.World;
- import java.util.List;
- /**
- * Created by RedBu on 3/21/2016.
- */
- public class ArmorTopazArmor extends ItemArmor {
- public ArmorTopazArmor(ArmorMaterial material, int renderIndex, EntityEquipmentSlot equipmentSlot) {
- super(material, renderIndex, equipmentSlot);
- setCreativeTab(SlurpiesDongles.tabSlurpiesDongles);
- }
- @Override
- public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot equipmentSlotIn, String layer) {
- if (equipmentSlotIn != EntityEquipmentSlot.LEGS) {
- return "slurpiesdongles:textures/models/armor/topaz_layer_1.png";
- } else
- {
- return "slurpiesdongles:textures/models/armor/topaz_layer_2.png";
- }
- }
- @Override
- public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
- if (stack.getItem() == SlurpiesDonglesItems.topaz_helmet) {
- this.effectPlayer(player, Potion.getPotionById(16), 0);
- }if (stack.getItem() == SlurpiesDonglesItems.topaz_leggings) {
- this.effectPlayer(player, Potion.getPotionById(1), 0);
- }if (stack.getItem() == SlurpiesDonglesItems.topaz_chestplate) {
- this.effectPlayer(player, Potion.getPotionById(12), 0);
- {
- if (player.getItemStackFromSlot(EntityEquipmentSlot.HEAD) !=null && player.getItemStackFromSlot(EntityEquipmentSlot.HEAD).getItem() == SlurpiesDonglesItems.topaz_helmet
- && player.getItemStackFromSlot(EntityEquipmentSlot.CHEST) !=null && player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).getItem() == SlurpiesDonglesItems.topaz_chestplate
- && player.getItemStackFromSlot(EntityEquipmentSlot.LEGS) !=null && player.getItemStackFromSlot(EntityEquipmentSlot.LEGS).getItem() == SlurpiesDonglesItems.topaz_leggings
- && player.getItemStackFromSlot(EntityEquipmentSlot.FEET) !=null && player.getItemStackFromSlot(EntityEquipmentSlot.FEET).getItem() == SlurpiesDonglesItems.topaz_boots)
- {
- if (!player.capabilities.isCreativeMode)
- {
- if (!player.capabilities.allowFlying)
- {
- player.capabilities.allowFlying = true;
- }
- }
- }
- else
- {
- if (!player.capabilities.isCreativeMode)
- {
- player.capabilities.isFlying = false;
- player.capabilities.allowFlying = false;
- }
- }
- }
- }
- }
- @Override
- public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
- {
- list.add("Wearing full set gives you flight!");
- }
- public void effectPlayer(EntityPlayer player, Potion potion, int amplifier){
- if(player.getActivePotionEffect(potion) == null || player.getActivePotionEffect(potion).getDuration() <= 1000){
- player.addPotionEffect(new PotionEffect(potion, 1000, amplifier, true, true));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement