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

Hello everyone,

Im trying to make armor which will work only if player.someBoolean == true that means that if the boolean is == false then player cannot place armor in his armor slot.

I was looking in ItemArmor.class but i cant find some method which is placing the armor in slot.

 

Thx for any help

I'm beginner in java and in minecraft modding.

Please be specific.

Any code examples are appreciated.

Sorry for my english i'm from Czech republic.

Please hit that thank you button if i helped :)

You can't do that without replacing whole inventory.

 

I was wrong. :C

1.7.10 is no longer supported by forge, you are on your own.

  • Author

Well thats unfortunate :/

I'm beginner in java and in minecraft modding.

Please be specific.

Any code examples are appreciated.

Sorry for my english i'm from Czech republic.

Please hit that thank you button if i helped :)

  • Author

So i have my armor class like this :

package fewmorethings.items.armor;

import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
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 fewmorethings.Main;
import fewmorethings.items.ArmoryHandler;

public class EmeraldArmor extends ItemArmor {
private static Item bootsEmerald;
private String [] armorTypes = new String [] {"EmeraldHelmet", "EmeraldChestplate", "EmeraldLeggings", "EmeraldBoots"};

public EmeraldArmor(ArmorMaterial armorMaterial, int renderIndex, int armorType){
	super(armorMaterial, renderIndex, armorType);
	this.setCreativeTab(Main.fmtab);
}

@Override
public String getArmorTexture(ItemStack stack, Entity entity,int slot, String layer){
	if(stack.getItem().equals(ArmoryHandler.EmeraldHelmet)|| stack.getItem().equals(ArmoryHandler.EmeraldChestplate)|| stack.getItem().equals(ArmoryHandler.EmeraldBoots)){
		return "fmt:textures/armor/EmeraldArmor1.png";
	}
	if(stack.getItem().equals(ArmoryHandler.EmeraldLeggings)){
		return "fmt:textures/armor/EmeraldArmor2.png";
	}
	else return null;
}

@Override
public void registerIcons(IIconRegister reg){
	if(this == ArmoryHandler.EmeraldHelmet)
		this.itemIcon = reg.registerIcon("fmt:EmeraldHelmet");
	if(this == ArmoryHandler.EmeraldChestplate)
		this.itemIcon = reg.registerIcon("fmt:EmeraldChestplate");
	if(this == ArmoryHandler.EmeraldLeggings)
		this.itemIcon = reg.registerIcon("fmt:EmeraldLeggings");
	if(this == ArmoryHandler.EmeraldBoots)
		this.itemIcon = reg.registerIcon("fmt:EmeraldBoots");

}

@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack itemstack){
	if(player.getCurrentArmor(3) != null && player.getCurrentArmor(2) != null && player.getCurrentArmor(1) !=null && player.getCurrentArmor(0) != null){
		ItemStack helmet = player.getCurrentArmor(3);
		ItemStack plate = player.getCurrentArmor(2);
		ItemStack leggings = player.getCurrentArmor(1);
		ItemStack boots = player.getCurrentArmor(0);
		if(helmet.getItem() == ArmoryHandler.EmeraldHelmet && plate.getItem() == ArmoryHandler.EmeraldChestplate && leggings.getItem() == ArmoryHandler.EmeraldLeggings && boots.getItem() == ArmoryHandler.EmeraldBoots){
		   player.addPotionEffect( new PotionEffect(Potion.resistance.getId(), 10, 60));
		}

	}

}
}


 

and init armor :

 

public static Item EmeraldHelmet = new EmeraldArmor(ArmorEmerald, 5, 0).setUnlocalizedName("EmeraldHelmet");
public static Item EmeraldChestplate = new EmeraldArmor(ArmorEmerald, 5, 1).setUnlocalizedName("EmeraldChestplate");
public static Item EmeraldLeggings = new EmeraldArmor(ArmorEmerald, 5, 2).setUnlocalizedName("EmeraldLeggings");
public static Item EmeraldBoots = new EmeraldArmor(ArmorEmerald, 5, 3).setUnlocalizedName("EmeraldBoots");

I'm beginner in java and in minecraft modding.

Please be specific.

Any code examples are appreciated.

Sorry for my english i'm from Czech republic.

Please hit that thank you button if i helped :)

  • Author

lol sorry i didnt say the main thing :D but never mind i figured it out thank you :)

I'm beginner in java and in minecraft modding.

Please be specific.

Any code examples are appreciated.

Sorry for my english i'm from Czech republic.

Please hit that thank you button if i helped :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

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.