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

Basically, I want to create custom armor. I'm having problems with getting the textures to appear. I've tried several different solutions but I seem to lack the basic knowledge.

 

I need to see a working 1.5 "public String getArmorTextureFile(ItemStack itemstack)" method. That is for the in-game armor right? Not the Icon?

 

Also, I need to see a working method that loads the icons.

 

I also need to know where the textures for the armor and the icon need to go. I do have a custom directory for all my textures.

 

1.5 has messed up all tutorials(1.4.7), and I have resorted to here for help.

 

Thanks for Any Replies!!  ;D

 

PS: I don't want to post any code because I don't believe it is necessary. I will post code if required.

I'm working on an armor myself,  and I sort've have an irrelevant question :P how did you set the custom Crafting Material?  the default is null, and so I keep getting null pointer exceptions, but I don't know where to change this =D

 

This is my getArmorTextureFile:

public String getArmorTextureFile(ItemStack par1){
	if(par1.itemID == mod_MoreStuff.RubyHelmet.itemID||par1.itemID == mod_MoreStuff.RubyChestplate.itemID||par1.itemID == mod_MoreStuff.RubyBoots.itemID){
		return "/mods/Water World/textures/armor/ruby_1.png";
	}
	if(par1.itemID == mod_MoreStuff.RubyLegs.itemID){
		return "/mods/Water World/textures/armor/ruby_2.png";
	}
	return "/mods/Water World/textures/armor/ruby_2.png";

}

  • Author

I'm working on an armor myself,  and I sort've have an irrelevant question :P how did you set the custom Crafting Material?  the default is null, and so I keep getting null pointer exceptions, but I don't know where to change this =D

 

This is my getArmorTextureFile:

public String getArmorTextureFile(ItemStack par1){
	if(par1.itemID == mod_MoreStuff.RubyHelmet.itemID||par1.itemID == mod_MoreStuff.RubyChestplate.itemID||par1.itemID == mod_MoreStuff.RubyBoots.itemID){
		return "/mods/Water World/textures/armor/ruby_1.png";
	}
	if(par1.itemID == mod_MoreStuff.RubyLegs.itemID){
		return "/mods/Water World/textures/armor/ruby_2.png";
	}
	return "/mods/Water World/textures/armor/ruby_2.png";

}

 

Excuse my noob-ness but what crafting material are you referring to? I can't send you code because I'm at school but I can answer answer from memory if possible. By the way, I solved my problem in this question Monday.

Well, there is a line in EnumArmorMaterial that says public int customCraftingMaterial = null, and above it is a comment saying added by forge.  but i found out thats not the problem, the damage reduce amount

this.damageReduceAmount = par2EnumArmorMaterial.getDamageReductionAmount(par4);

in ItemArmor is throwing a null for some reason.  When you get home, could you post your armor code?

I've done custom armor too, it could be a little messy, but it works and i haven't any problem with it

 

ENUM in main

public static final EnumArmorMaterial ARMORA=EnumHelper.addArmorMaterial("ARMORA", 200, new int[]{2, 3, 2, 2}, 15);

 

the item init

armorHelmet = new Armor(armorHelmetID, ARMORA, 2, 0).setUnlocalizedName("armorHelmet");

 

and part of the Armor class

int armtype;

public Armor(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4) {

	super(par1, par2EnumArmorMaterial,par3,par4);
	this.armtype=par4;
}

@Override
public void updateIcons(IconRegister iconRegister)
{
	switch (armtype){
	case 0:
        iconIndex = iconRegister.registerIcon("myModName:armorHelmet");
        break;
	case 1:
		iconIndex = iconRegister.registerIcon("myModName:armorPlate");
        break;
	case 2:
		iconIndex = iconRegister.registerIcon("myModName:armorLegs");
        break;
	case 3:
		iconIndex = iconRegister.registerIcon("myModName:armorBoots");
        break;
	}

The par4 is the armortype (used in updateIcons in my case), the int armtype is just a helper.

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.