G2A Many GEOs
SHARE
TWEET

Untitled

a guest Jan 17th, 2019 25 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package net.mod.topazmod.armorTopazia;
  2.  
  3. import cpw.mods.fml.relauncher.Side;
  4. import cpw.mods.fml.relauncher.SideOnly;
  5. import net.minecraft.client.model.ModelBiped;
  6. import net.minecraft.client.renderer.texture.IIconRegister;
  7. import net.minecraft.creativetab.CreativeTabs;
  8. import net.minecraft.entity.Entity;
  9. import net.minecraft.entity.EntityLivingBase;
  10. import net.minecraft.entity.player.EntityPlayer;
  11. import net.minecraft.item.EnumAction;
  12. import net.minecraft.item.ItemArmor;
  13. import net.minecraft.item.ItemStack;
  14. import net.mod.topazmod.Reference;
  15. import net.mod.topazmod.ressources;
  16. import net.mod.topazmod.proxy.ClientProxy;
  17.  
  18.  
  19. public class ItemArmorTopaze extends ItemArmor{
  20.  
  21.     public ItemArmorTopaze(ArmorMaterial material, int render_idx, int type) {
  22.         super(material, render_idx, type);
  23.        
  24.         this.setMaxStackSize(1);
  25.         this.setCreativeTab(CreativeTabs.tabMisc);
  26.        
  27.     }
  28.    
  29.     @Override
  30.     public String getUnlocalizedName(){
  31.         return String.format("item.%s%s", ressources.RESOURCE_PREFIX, getUnwrappedUnlocalizedName(super.getUnlocalizedName()));
  32.     }
  33.    
  34.     @Override
  35.     public String getUnlocalizedName(ItemStack itemstack){
  36.         return String.format("item.%s%s", ressources.RESOURCE_PREFIX, getUnwrappedUnlocalizedName(super.getUnlocalizedName()));
  37.     }
  38.    
  39.     protected String getUnwrappedUnlocalizedName(String unlocalizedName){      
  40.         return unlocalizedName.substring(unlocalizedName.indexOf('.') + 1);
  41.     }
  42.    
  43.     @Override
  44.     @SideOnly(Side.CLIENT)
  45.     public void registerIcons(IIconRegister iconRegister){
  46.         this.itemIcon = iconRegister.registerIcon(this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf('.') + 1));
  47.     }
  48.    
  49.     @Override
  50.     @SideOnly(Side.CLIENT)
  51.     public ModelBiped getArmorModel (EntityLivingBase entityLiving, ItemStack itemstack, int armorSlot){
  52.        
  53.         ModelBiped armorModelHelmet = ClientProxy.armorModelsHelmet.get(this);
  54.        
  55.         if(armorModelHelmet != null){
  56.             armorModelHelmet.bipedHead.showModel = armorSlot == 0;
  57.             armorModelHelmet.bipedHeadwear.showModel = false;
  58.             armorModelHelmet.bipedBody.showModel = armorSlot == 1 || armorSlot == 2;
  59.             armorModelHelmet.bipedRightArm.showModel = armorSlot == 1;
  60.             armorModelHelmet.bipedLeftArm.showModel = armorSlot == 1;
  61.             armorModelHelmet.bipedRightLeg.showModel = armorSlot == 2 || armorSlot == 3;
  62.             armorModelHelmet.bipedLeftLeg.showModel = armorSlot == 2 || armorSlot == 3;
  63.            
  64.             armorModelHelmet.isSneak = entityLiving.isSneaking();
  65.             armorModelHelmet.isRiding = entityLiving.isRiding();
  66.             armorModelHelmet.isChild = entityLiving.isChild();
  67.            
  68.             armorModelHelmet.heldItemRight = 0;
  69.             armorModelHelmet.aimedBow = false;
  70.            
  71.             EntityPlayer player = (EntityPlayer)entityLiving;
  72.            
  73.             ItemStack held_item = player.getEquipmentInSlot(0);
  74.            
  75.             if (held_item != null){
  76.                 armorModelHelmet.heldItemRight = 1;
  77.                
  78.                 if (player.getItemInUseCount() > 0){
  79.                    
  80.                     EnumAction enumaction = held_item.getItemUseAction();
  81.                    
  82.                     if (enumaction == EnumAction.bow){
  83.                         armorModelHelmet.aimedBow = true;
  84.                     }else if (enumaction == EnumAction.block){
  85.                         armorModelHelmet.heldItemRight = 3;
  86.                     }
  87.                    
  88.                    
  89.                 }
  90.                
  91.             }
  92.            
  93.            
  94.         }
  95.        
  96.        
  97.         return armorModelHelmet;
  98.    
  99.        
  100.     }
  101.  
  102.        
  103.  
  104.    
  105.    
  106.     @Override
  107.     public String getArmorTexture(ItemStack stack, Entity entity, int slot, String layer){
  108.        
  109.         String name = this.getUnwrappedUnlocalizedName(super.getUnlocalizedName());
  110.         name = name.substring(0, name.indexOf('_'));
  111.        
  112.         return Reference.MOD_ID + ":textures/models/armor/topaz_armor_layer_1.png";
  113.        
  114.  
  115.    
  116.     }
  117.    
  118. }
RAW Paste Data
Ledger Nano X - The secure hardware wallet
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top