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

Hi, I added my custom armour into the game, and everything working, textures, name everything apart from it actually being in the menu! My Armour is only craftable, not even appearing in the creative interface! Help please? Armour Code=

 

package me.irule2222.stuffmod;

import net.minecraft.entity.Entity;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;

public class ElderArmour extends ItemArmor {





public ElderArmour(ArmorMaterial material, int id,
		int placement) {
	super(material, id, placement);
	setCreativeTab(StuffMain.StuffMod);

	if (placement == 0) {//if placement is helmet
		this.setTextureName(StuffMain.modid + ":" + "ElderHelmet");

	}else if (placement == 1) {// piece is chestplate
		this.setTextureName(StuffMain.modid + ":" + "ElderChestplate");

	}else if (placement == 2) {// piece is leggins
		this.setTextureName(StuffMain.modid + ":" + "ElderLeggins");

	}else if (placement == 3) {// piece is boots
		this.setTextureName(StuffMain.modid + ":" + "ElderBoots");

	}
	}

public String getArmorTexture(ItemStack stack, Entity entity, int Slot, String type) {
	if (stack.getItem() == StuffMain.ElderHelmet || stack.getItem() == StuffMain.ElderChestplate || stack.getItem() == StuffMain.ElderBoots) {
		return StuffMain.modid + ":" + "textures/models/armor/ElderArmor_1.png";
		}
	if (stack.getItem() == StuffMain.ElderLeggins) {
		return StuffMain.modid + ":" + "textures/models/armor/ElderArmor_2.png";

	}else{
		return null;
	}

}

}

Try setting your creative tab in your main mod class and removing it from this class.

 

This actually doesn't matter

 

@OP: In which order do you instantiate the item and creativetab? Sounds to me you instantiate the item first and then the creativetab.

We can't tell for sure as long as you don't show us your main mod file.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

  • Author

Try setting your creative tab in your main mod class and removing it from this class.

 

This actually doesn't matter

 

@OP: In which order do you instantiate the item and creativetab? Sounds to me you instantiate the item first and then the creativetab.

We can't tell for sure as long as you don't show us your main mod file.

 

package me.irule2222.stuffmod;

import me.irule2222.suffmod.worldgen.ElderOreWG;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemArmor.ArmorMaterial;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.EnumHelper;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;

/**
* 
*/


@Mod(modid = StuffMain.name, version = StuffMain.version) 
public class StuffMain {

	//*create the base for things*\\
	public static final String modid = "StuffMod";
	public static final String version = "Pre Alpha 0.1.0";
	public static final String name = "Stuff Mod";

	public static int helmetId;
	public static int chestplateId;
	public static int legginsId;
	public static int bootsId;


	public static Block RottenWood;
	public static Block ElderOre;
	public static Block poo;
	public static Item DigestedMush;
	public static Item RottenFlakes;
	public static Item ElderIngot;
	public static ToolMaterial Eldert = EnumHelper.addToolMaterial("Eldert", 3, 99999, 12.0f, 90.0f, 10);
	public static ToolMaterial Redstone = EnumHelper.addToolMaterial("Redstone", 1, 200, 6.0f, 5.0f, 10);
	public static ArmorMaterial Elder = EnumHelper.addArmorMaterial("Elder", 99, new int [] {6, 16 ,12 ,6}, 10);
	//public static ToolMaterial test = EnumHelper.addToolMaterial(name, harvestLevel, maxUses, efficiency, damage, enchantability)
	//public static Armormaterial test = EnumHelper.addArmorMaterial(name, durability, reductionAmounts, enchantability)

	public static Item ElderSword; 
	public static Item RedstoneSword;
	public static Item RedstonePickaxe;
	public static Item RedstoneHoe;
	public static Item RedstoneShovel;
	public static Item RedstoneAxe;
	public static Block ElderBlock;

    public static Item ElderHelmet = new ElderArmour(Elder, helmetId, 0).setUnlocalizedName("ElderHelmet"); 
	public static Item ElderChestplate = new ElderArmour(Elder, chestplateId, 1).setUnlocalizedName("ElderChestplate");
	public static Item ElderLeggins = new ElderArmour(Elder, legginsId, 2).setUnlocalizedName("ElderLeggins"); 
	public static Item ElderBoots = new ElderArmour(Elder, bootsId, 3).setUnlocalizedName("Elderboots"); 




	public static ElderOreWG worldgen1 = new ElderOreWG();

	public static CreativeTabs StuffMod = new CreativeTabs("StuffMod"){

		public Item getTabIconItem() {
			return Item.getItemFromBlock(StuffMain.ElderOre);
		}

	};

	//register things
	@EventHandler
	public void preinit(FMLPreInitializationEvent e){

		GameRegistry.registerItem(ElderHelmet, "ElderHelmet");
		GameRegistry.registerItem(ElderChestplate, "ElderChestplate");
		GameRegistry.registerItem(ElderLeggins, "ElderLeggins");
		GameRegistry.registerItem(ElderBoots, "ElderBoots");

		//ROttenFlakes
		RottenFlakes = new Item().setUnlocalizedName("RottenFlakes").setCreativeTab(StuffMod).setTextureName(modid + ":" + "RottenFlakes").setFull3D();
		GameRegistry.registerItem(RottenFlakes, "RottenFlakes");

		//ElderIngot
		ElderIngot = new Item().setUnlocalizedName("ElderIngot").setCreativeTab(StuffMod).setFull3D().setTextureName(modid + ":" + "ElderIngot");
		GameRegistry.registerItem(ElderIngot, "ElderIngot");



		//rottenwood
		RottenWood = new RottenWood().setBlockName("RottenWood").setCreativeTab(StuffMod).setHardness(0).setBlockTextureName(modid + ":" + "RottenWood");
		GameRegistry.registerBlock(RottenWood, "RottenWood");

		//Elder Block
		ElderBlock = new ElderBlock().setBlockName("ElderBlock").setCreativeTab(StuffMod).setHardness(10.0f).setResistance(10.0f);
		GameRegistry.registerBlock(ElderBlock, "ElderBlock");

		//poo
		poo = new Poo().setBlockName("Poo").setCreativeTab(StuffMod).setHardness(0).setBlockTextureName(modid + ":" + "poo");
		GameRegistry.registerBlock(poo, "Poo");

		//Digested Mush
		DigestedMush = new Item().setUnlocalizedName("DigestedMush").setCreativeTab(StuffMod).setTextureName(modid + ":" + "DGMSH");
		GameRegistry.registerItem(DigestedMush, "DigestedMush");


		//world generation
		GameRegistry.registerWorldGenerator(worldgen1, 1);

		//tools
		ElderSword = new ElderSwordClass().setUnlocalizedName("ElderSword");
		GameRegistry.registerItem(ElderSword, "ElderSword");

		RedstoneSword = new RedstoneSwordClass().setUnlocalizedName("RedstoneSword");
		GameRegistry.registerItem(RedstoneSword, "RedstoneSword");

		RedstonePickaxe = new RedstonePickaxeClass().setUnlocalizedName("RedstonePickaxe");
		GameRegistry.registerItem(RedstonePickaxe, "RedstonePickaxe");

		RedstoneHoe = new RedstoneHoeClass().setUnlocalizedName("RedstoneHoe");
		GameRegistry.registerItem(RedstoneHoe, "RedstoneHoe");

		RedstoneShovel = new RedstoneShovelClass().setUnlocalizedName("RedstoneShovel");
		GameRegistry.registerItem(RedstoneShovel, "RedstoneShovel");

		RedstoneAxe = new RedstoneAxeClass().setUnlocalizedName("RedstoneAxe");
		GameRegistry.registerItem(RedstoneAxe, "RedstoneAxe");

		//Armour











		//Elder Ore
		ElderOre = new ElderOre().setBlockName("ElderOre").setCreativeTab(StuffMod).setHardness(5f).setResistance(7.0f).setBlockTextureName(modid + ":" + "ElderOre");
		GameRegistry.registerBlock(ElderOre, "ElderOre");




		//wood biome
		//WoodBiome = new BiomeGenWoodBiome(137).setBiomeName("Wood Land");
		//BiomeDictionary.registerBiomeType(WoodBiome);
	   // BiomeManager.addSpawnBiome(WoodBiome);


		//Crafting Recepies
		GameRegistry.addRecipe(new ItemStack(ElderSword, 1), new Object [] {
			" E ", 
			"EEE",
			" S ", 'E', ElderIngot, 'S', Item.itemRegistry.getObject("stick")});

		GameRegistry.addRecipe(new ItemStack(ElderBlock, 1), new Object [] {
			"EEE",
			"EEE",
			"EEE", 'E', ElderIngot});

		GameRegistry.addRecipe(new ItemStack(RedstoneSword, 1), new Object [] {
			" R ",
			" R ",
			" S ", 'R', Item.itemRegistry.getObject("redstone"), 'S', Item.itemRegistry.getObject("stick")
		});

		GameRegistry.addRecipe(new ItemStack(RedstonePickaxe, 1), new Object [] {
			"RRR",
			" S ",
			" S ", 'R', Item.itemRegistry.getObject("redstone"), 'S', Item.itemRegistry.getObject("stick")
		});

		GameRegistry.addRecipe(new ItemStack(RedstoneShovel, 1), new Object [] {
			" R ",
			" S ",
			" S ", 'R', Item.itemRegistry.getObject("redstone"), 'S', Item.itemRegistry.getObject("stick")
		});

		GameRegistry.addRecipe(new ItemStack(RedstoneAxe, 1), new Object [] {
			"RR ",
			"RS ",
			" S ", 'R', Item.itemRegistry.getObject("redstone"), 'S', Item.itemRegistry.getObject("stick")
		});

		GameRegistry.addRecipe(new ItemStack(RedstoneHoe, 1), new Object [] {
			"RR ",
			" S ",
			" S ", 'R', Item.itemRegistry.getObject("redstone"), 'S', Item.itemRegistry.getObject("stick")
		});

	    GameRegistry.addRecipe(new ItemStack(ElderHelmet, 1), new Object [] {"EEE","E E",	"   ", 'E', ElderIngot});

		GameRegistry.addRecipe(new ItemStack(ElderChestplate, 1), new Object [] {"E E", "EEE","EEE", 'E', ElderIngot});

		GameRegistry.addRecipe(new ItemStack(ElderLeggins, 1), new Object [] {"EEE", "E E", "E E", 'E', ElderIngot});

		GameRegistry.addRecipe(new ItemStack(ElderBoots, 1), new Object [] {"   ", "E E", "E E", 'E', ElderIngot});	










		GameRegistry.addShapelessRecipe(new ItemStack(ElderIngot, 9), ElderBlock);



		//Smelting recepie
		GameRegistry.addSmelting(ElderOre, new ItemStack(ElderIngot), 2.50F);

	}
}

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.