Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Please explain to me why this doesn't work?

package mymod.items;

import cpw.mods.fml.common.network.Player;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import mymod.Main;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumArmorMaterial;
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;

public class MyArmor2 extends ItemArmor{

    private String texturePath = "mymod:textures/armor/";
    private String iconPath = "mymod:";

    public MyArmor2(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4, String myArmorName) {
        super(par1, par2EnumArmorMaterial, par3, par4);
        this.setMaxStackSize(1);
        this.setCreativeTab(CreativeTabs.tabCombat);
        this.SetArmorType(myArmorName, par4);
    }


    private void SetArmorType(String myArmorName, int par4)
    {
        switch(par4)
        {
        case 0:
            this.setUnlocalizedName("MyHelmet_2");
            this.texturePath += myArmorName + "_3.png";
            this.iconPath += "MyHelmet_2";
            break;
        case 1:
            this.setUnlocalizedName("MyChest_2");
            this.texturePath += myArmorName + "_3.png";
            this.iconPath += "MyChest_2";
            break;
        case 2:
            this.setUnlocalizedName("MyLeggings_2");
            this.texturePath += myArmorName + "_4.png";
            this.iconPath += "MyLeggings_2";
            break;
        case 3:
            this.setUnlocalizedName("MyBoots_2");
            this.texturePath += myArmorName + "_3.png";
            this.iconPath += "MyBoots_2";
            break;
        }
    }
    
   
    public void onArmorTickUpdate(World world, EntityPlayer player, ItemStack itemStack) {

    	if (player.getCurrentItemOrArmor(4) != null && player.getCurrentArmor(3) != null && player.getCurrentItemOrArmor(2) != null && player.getCurrentItemOrArmor(1) != null) {
    	ItemStack helmet = player.getCurrentItemOrArmor(4);
    	ItemStack plate = player.getCurrentItemOrArmor(3);
    	ItemStack legs = player.getCurrentItemOrArmor(2);
    	ItemStack boots = player.getCurrentItemOrArmor(1); 

    	if (helmet.getItem() == Main.MyHelmet_2&& plate.getItem() == Main.MyChest_2&& legs.getItem() == Main.MyLeggings_2&& boots.getItem() == Main.MyBoots_2) 
    	{
    		player.addPotionEffect(new PotionEffect(Potion.invisibility.id, 10, 0));
    		player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 10, 3));
    		player.fallDistance = 0.0F;
    		player.capabilities.allowFlying = true;
    	
    		
    	}
    	
    	
    	if (helmet.getItem() != Main.MyHelmet_2|| plate.getItem() != Main.MyChest_2||legs.getItem() != Main.MyLeggings_2|| boots.getItem() != Main.MyBoots_2) 
    	{
    		
    		player.fallDistance = 10.0F;
    		player.capabilities.allowFlying = false;
    	
    		
    	}
    	
    	
    	
    	
    	
    		
    		}
    	}
    	
    	
    

//@Override
//public void onArmorTickUpdate(World world, EntityPlayer player, ItemStack stack)
//{
	
	
//}

    @SideOnly(Side.CLIENT)
    public void registerIcons(IconRegister reg)
    {
        this.itemIcon = reg.registerIcon(this.iconPath);
    }

    public String getArmorTexture(ItemStack stack, Entity entity, int layer, int slot)
    {
        return this.texturePath;
    }

}

Thaks a lot! :)

  • Guest locked this topic
Guest
This topic is now closed to further replies.

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.