Advertisement
lol123406

Untitled

Apr 29th, 2015
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.83 KB | None | 0 0
  1. package net.Ethereal.armor;
  2.  
  3. import cpw.mods.fml.relauncher.Side;
  4. import cpw.mods.fml.relauncher.SideOnly;
  5. import net.Ethereal.main.ClientProxy;
  6. import net.Ethereal.main.EtherealMain;
  7. import net.Ethereal.main.EtherealStrings;
  8. import net.lucrecious.tutorialmod.proxy.ProxyClient;
  9. import net.minecraft.client.model.ModelBiped;
  10. import net.minecraft.entity.Entity;
  11. import net.minecraft.entity.EntityLivingBase;
  12. import net.minecraft.entity.player.EntityPlayer;
  13. import net.minecraft.item.EnumAction;
  14. import net.minecraft.item.Item;
  15. import net.minecraft.item.ItemArmor;
  16. import net.minecraft.item.ItemStack;
  17. import net.minecraft.potion.Potion;
  18. import net.minecraft.potion.PotionEffect;
  19. import net.minecraft.world.World;
  20.  
  21. public class EtherealArmor extends ItemArmor {
  22.  
  23.     public EtherealArmor(ArmorMaterial material,int id, int armorPlacement) {
  24.         super(material, id, armorPlacement);
  25.         setCreativeTab(EtherealMain.EtherealTabCombat);
  26.        
  27.         if(armorPlacement == 0){
  28.             this.setTextureName(EtherealStrings.modid + ":" + "EtherealHelm");
  29.         }else if(armorPlacement == 1){
  30.             this.setTextureName(EtherealStrings.modid + ":" + "EtherealChestplate");
  31.            
  32.         }else if(armorPlacement == 2){
  33.             this.setTextureName(EtherealStrings.modid + ":" + "EtherealPants");
  34.            
  35.         }else if(armorPlacement == 3){
  36.             this.setTextureName(EtherealStrings.modid + ":" + "EtherealBoots");
  37.            
  38.         }
  39.        
  40.     }
  41.  
  42.      
  43.  
  44.         public String getArmorTexture(ItemStack stack, Entity entity,  int slot, String type) {
  45.             if (stack.getItem() == EtherealMain.itemEtherealHelm || stack.getItem() == EtherealMain.itemEtherealChestplate || stack.getItem() == EtherealMain.itemEtherealBoots) {
  46.                 return EtherealStrings.modid + ":textures/armor/Ethereal_1.png";
  47.                
  48.             }else if (stack.getItem() == EtherealMain.itemEtherealPants) {
  49.                 return EtherealStrings.modid + ":textures/armor/Ethereal_2.png";
  50.         }else{
  51.             return null;
  52.         }
  53.         }
  54.         @SideOnly(Side.CLIENT)
  55.         public ModelBiped getArmorModel (EntityLivingBase entityLiving, ItemStack itemstack, int armorSlot){
  56.            
  57.             ModelBiped armorModel = ClientProxy.armorModels.get(this);
  58.            
  59.             if(armorModel != null){
  60.                 armorModel.bipedHead.showModel = armorSlot == 0;
  61.                 armorModel.bipedHeadwear.showModel = false;
  62.                 armorModel.bipedBody.showModel = armorSlot == 1 || armorSlot == 2;
  63.                 armorModel.bipedRightArm.showModel = armorSlot == 1;
  64.                 armorModel.bipedLeftArm.showModel = armorSlot == 1;
  65.                 armorModel.bipedRightLeg.showModel = armorSlot == 2 || armorSlot == 3;
  66.                 armorModel.bipedLeftLeg.showModel = armorSlot == 2 || armorSlot == 3;
  67.                
  68.                 armorModel.isSneak = entityLiving.isSneaking();
  69.                 armorModel.isRiding = entityLiving.isRiding();
  70.                 armorModel.isChild = entityLiving.isChild();
  71.                
  72.                 armorModel.heldItemRight = 0;
  73.                 armorModel.aimedBow = false;
  74.                
  75.                 EntityPlayer player = (EntityPlayer)entityLiving;
  76.                
  77.                 ItemStack held_item = player.getEquipmentInSlot(0);
  78.                
  79.                 if (held_item != null){
  80.                     armorModel.heldItemRight = 1;
  81.                    
  82.                     if (player.getItemInUseCount() > 0){
  83.                        
  84.                         EnumAction enumaction = held_item.getItemUseAction();
  85.                        
  86.                         if (enumaction == EnumAction.bow){
  87.                             armorModel.aimedBow = true;
  88.                         }else if (enumaction == EnumAction.block){
  89.                             armorModel.heldItemRight = 3;
  90.                         }
  91.                        
  92.                        
  93.                     }
  94.                    
  95.                 }
  96.                
  97.                
  98.             }
  99.            
  100.            
  101.             return armorModel;
  102.         }
  103.  
  104.            
  105.             public void onArmorTick(World world, EntityPlayer player, ItemStack itemstack){
  106.                
  107.                
  108.                
  109.            
  110.             if (player.getCurrentArmor(3) != null){
  111.                 ItemStack helmet = player.getCurrentArmor(3);
  112.                 if (helmet.getItem() == EtherealMain.itemEtherealHelm)
  113.                     player.addPotionEffect(new PotionEffect (Potion.nightVision.getId(), 1000));
  114.            
  115.                
  116.                
  117.         if (player.getCurrentArmor(3) != null && player.getCurrentArmor(2) != null && player.getCurrentArmor(1) != null && player.getCurrentArmor(0) != null){
  118.             ItemStack helmet1 = player.getCurrentArmor(3);
  119.             ItemStack chestplate = player.getCurrentArmor(2);
  120.             ItemStack pants = player.getCurrentArmor(1);
  121.             ItemStack boots = player.getCurrentArmor(0);
  122.            
  123.             if (helmet1.getItem() == EtherealMain.itemEtherealHelm && chestplate.getItem() == EtherealMain.itemEtherealChestplate && pants.getItem() == EtherealMain.itemEtherealPants && boots.getItem() == EtherealMain.itemEtherealBoots){
  124.                 player.addPotionEffect(new PotionEffect (Potion.fireResistance.getId(), 1000));
  125.                 player.addPotionEffect(new PotionEffect (Potion.resistance.getId(), 1000));
  126.                 player.addPotionEffect(new PotionEffect (Potion.damageBoost.getId(), 1000));
  127.                 player.addPotionEffect(new PotionEffect (Potion.waterBreathing.getId(), 1000));
  128.                 player.addPotionEffect(new PotionEffect (Potion.regeneration.getId(), 1000));
  129.             }
  130.         }
  131.    
  132.            
  133.     }
  134.        
  135. }
  136. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement