Jump to content

Armor in 1.8


Wooden_Brick

Recommended Posts

Does armor now have only 1 layer or 2? Cause i have 2 layers - one for the top part and 1 for the bottom part of the armor. Im using this code and it doesnt work -

 

@Override

public String getArmorTexture(ItemStack stack,Entity entity, int slot, String type)

{

if(this.armorType == 2) {

return "tm:textures/models/armor/cheese_layer_2.png";

}

 

return "tm:textures/models/armor/cheese_layer_1.png";

}

 

Link to comment
Share on other sites

Main:

 

package com.Babuska;

 

import net.minecraftforge.fml.common.Mod;

import net.minecraftforge.fml.common.Mod.EventHandler;

import net.minecraftforge.fml.common.SidedProxy;

import net.minecraftforge.fml.common.event.FMLInitializationEvent;

import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;

import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

import net.minecraftforge.fml.common.registry.GameRegistry;

 

import com.Babuska.init.TutorialBlocks;

import com.Babuska.init.TutorialItems;

import com.Babuska.proxy.CommonProxy;

 

 

@Mod(modid = References.MOD_ID, name = References.MOD_NAME, version = References.VERSION)

public class TutorialMod {

@SidedProxy(clientSide = References.CLIENT_PROXY_CLASS, serverSide = References.SERVER_PROXY_CLASS)

public static CommonProxy proxy;

 

@EventHandler

public void preInit(FMLPreInitializationEvent event){

TutorialBlocks.init();

TutorialBlocks.register();

TutorialItems.init();

TutorialItems.register();

TutorialItems.registerRecipes();

}

@EventHandler

public void init(FMLInitializationEvent event){

proxy.registerRenders();

 

}

 

@EventHandler

public void postInit(FMLPostInitializationEvent event){

 

}

 

 

 

}

 

ItemGemArmour class:

 

package com.Babuska.items;

 

import net.minecraft.entity.Entity;

import net.minecraft.item.ItemArmor;

import net.minecraft.item.ItemStack;

 

public class ItemGemArmor extends ItemArmor {

 

public ItemGemArmor(ArmorMaterial material, int renderIndex,

int armorType) {

super(material, renderIndex, armorType);

// TODO Auto-generated constructor stub

}

@Override

public String getArmorTexture(ItemStack stack,Entity entity, int slot, String type)

{

if(this.armorType == 2) {

return "tm:textures/models/armor/cheese_layer_2.png";

}

 

return "tm:textures/models/armor/cheese_layer_1.png";

}

 

}

 

Where all my items are class:

 

package com.Babuska.init;

 

import net.minecraft.client.Minecraft;

import net.minecraft.client.resources.model.ModelResourceLocation;

import net.minecraft.init.Items;

import net.minecraft.item.Item;

import net.minecraft.item.ItemArmor;

import net.minecraft.item.ItemStack;

import net.minecraftforge.common.util.EnumHelper;

import net.minecraftforge.fml.common.registry.GameRegistry;

 

import com.Babuska.References;

import com.Babuska.items.ItemGemArmor;

import com.Babuska.items.ItemGemPickaxe;

 

 

public class TutorialItems {

 

public static Item test_item;

public static Item gem_1;

public static Item gem_pickaxe;

public static Item gem_helmet;

public static Item gem_chest;

public static Item gem_legs;

public static Item gem_boots;

 

public static final Item.ToolMaterial gemToolMaterial = EnumHelper.addToolMaterial("gemToolMaterial", 2, 512, 7.0F, 2.0F, 10);

public static final ItemArmor.ArmorMaterial gemArmorMaterial = EnumHelper.addArmorMaterial("gemArmorMaterial" , null, 1024,new int[]{5,9,7,5}, 30);

 

public static void init(){

test_item = new Item().setUnlocalizedName("test_item");

gem_1 = new Item().setUnlocalizedName("gem_1");

gem_pickaxe = new ItemGemPickaxe(gemToolMaterial).setUnlocalizedName("gem_pickaxe");

gem_helmet = new ItemGemArmor(gemArmorMaterial, 0, 0).setUnlocalizedName("gem_helmet");

gem_chest = new ItemGemArmor(gemArmorMaterial, 0, 1).setUnlocalizedName("gem_chest");

gem_legs = new ItemGemArmor(gemArmorMaterial, 0, 2).setUnlocalizedName("gem_legs");

gem_boots = new ItemGemArmor(gemArmorMaterial, 0, 3).setUnlocalizedName("gem_boots");

 

 

}

 

public static void register() {

GameRegistry.registerItem(test_item, test_item.getUnlocalizedName().substring(5)); //"tile.test_item"

GameRegistry.registerItem(gem_1, gem_1.getUnlocalizedName().substring(5));

GameRegistry.registerItem(gem_pickaxe, gem_pickaxe.getUnlocalizedName().substring(5));

GameRegistry.registerItem(gem_helmet, gem_helmet.getUnlocalizedName().substring(5));

GameRegistry.registerItem(gem_chest, gem_chest.getUnlocalizedName().substring(5));

GameRegistry.registerItem(gem_legs, gem_legs.getUnlocalizedName().substring(5));

GameRegistry.registerItem(gem_boots, gem_boots.getUnlocalizedName().substring(5));

 

}

 

public static void registerRenders() {

 

registerRender(test_item);

registerRender(gem_1);

registerRender(gem_pickaxe);

registerRender(gem_helmet);

registerRender(gem_chest);

registerRender(gem_legs);

registerRender(gem_boots);

 

}

 

 

public static void registerRender(Item item) {

 

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(References.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory"));

 

}

 

public static void registerRecipes() {

recipePickaxe();

recipeHelmet();

recipeChest();

recipeLegs();

recipeBoots();

}

 

public static void recipePickaxe()

{

GameRegistry.addRecipe(new ItemStack(gem_pickaxe, 1), new Object[]{"TTT",

                                                              " S ",

                                                              " S ",'T',TutorialItems.gem_1,'S',Items.stick});

}

 

public static void recipeHelmet()

{

GameRegistry.addRecipe(new ItemStack(gem_helmet, 1), new Object[]{"GGG",

                                                              "G G ",

                                                              "  ",'G',TutorialItems.gem_1});

}

 

public static void recipeChest()

{

GameRegistry.addRecipe(new ItemStack(gem_chest, 1), new Object[]{"G G",

                                                            "GGG",

                                                            "GGG",'G',TutorialItems.gem_1});

}

 

public static void recipeLegs()

{

GameRegistry.addRecipe(new ItemStack(gem_legs, 1), new Object[]{"GGG",

                                                            "G G",

                                                            "G G",'G',TutorialItems.gem_1});

}

 

public static void recipeBoots()

{

GameRegistry.addRecipe(new ItemStack(gem_boots, 1), new Object[]{"  ",

                                                            "G G",

                                                            "G G",'G',TutorialItems.gem_1});

}

 

 

}

 

 

the armor pngs are in Assets.tm/models/armor

Link to comment
Share on other sites

Are you sure that pngs are correct? (I mean that leg png has legs, etc...)

Also, how exactly is it rendered: black&purple or wierd missplaced squares?

If all above is correct, add printin to this method, and check for item - type - texture...

Link to comment
Share on other sites

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

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