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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I had a similar issue to what you do above. Given this is an old post, you've probably sorted this now In my case, I had Java (JDK) 22 installed. After uninstalling that and installing 17.0.11 (having both installed gives the same error), then running the startserver.bat worked for me. I managed to get to the EULA section and then start my server correctly- I hope it helps anyone else who may have this issue!
    • Make a test with another Launcher like MultiMC, AT Launcher or Technic Launcher
    • I opened up Minecraft today for the first time in a month and whenever I try and play forge I get an error 1 message. I restarted my computer, tried reinstalling both Minecraft and Forge and have updated all of my drivers. Nothing seems to work so I'm stumped. I have absolutely no mods installed ATM so I have no idea what could be causing the problem. I hope yall are able to help.   DebugLog:   [19May2024 20:33:51.600] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher running: args [--username, dmoy18, --version, 1.20.1-forge-47.2.0, --gameDir, C:\Users\dmoyf\AppData\Roaming\.minecraft, --assetsDir, C:\Users\dmoyf\AppData\Roaming\.minecraft\assets, --assetIndex, 5, --uuid, c083972cd92d4dd2894beb25b82ebe82, --accessToken, ????????, --clientId, MDljMzIwMjYtOTJiNS00YWUxLTk1M2EtN2ExMGExZWM0MDAw, --xuid, 2535417310772497, --userType, msa, --versionType, release, --quickPlayPath, C:\Users\dmoyf\AppData\Roaming\.minecraft\quickPlay\java\1716168829421.json, --launchTarget, forgeclient, --fml.forgeVersion, 47.2.0, --fml.mcVersion, 1.20.1, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20230612.114412] [19May2024 20:33:51.604] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher 10.0.9+10.0.9+main.dcd20f30 starting: java version 17.0.8 by Microsoft; OS Windows 11 arch amd64 version 10.0 [19May2024 20:33:51.634] [main/DEBUG] [cpw.mods.modlauncher.LaunchServiceHandler/MODLAUNCHER]: Found launch services [fmlclientdev,forgeclient,minecraft,forgegametestserverdev,fmlserveruserdev,fmlclient,fmldatauserdev,forgeserverdev,forgeserveruserdev,forgeclientdev,forgeclientuserdev,forgeserver,forgedatadev,fmlserver,fmlclientuserdev,fmlserverdev,forgedatauserdev,testharness,forgegametestserveruserdev] [19May2024 20:33:51.653] [main/DEBUG] [cpw.mods.modlauncher.NameMappingServiceHandler/MODLAUNCHER]: Found naming services : [srgtomcp] [19May2024 20:33:51.668] [main/DEBUG] [cpw.mods.modlauncher.LaunchPluginHandler/MODLAUNCHER]: Found launch plugins: [mixin,eventbus,slf4jfixer,object_holder_definalize,runtime_enum_extender,capability_token_subclass,accesstransformer,runtimedistcleaner] [19May2024 20:33:51.681] [main/DEBUG] [cpw.mods.modlauncher.TransformationServicesHandler/MODLAUNCHER]: Discovering transformation services [19May2024 20:33:51.688] [main/DEBUG] [net.minecraftforge.fml.loading.FMLPaths/CORE]: Path GAMEDIR is C:\Users\dmoyf\AppData\Roaming\.minecraft [19May2024 20:33:51.689] [main/DEBUG] [net.minecraftforge.fml.loading.FMLPaths/CORE]: Path MODSDIR is C:\Users\dmoyf\AppData\Roaming\.minecraft\mods [19May2024 20:33:51.689] [main/DEBUG] [net.minecraftforge.fml.loading.FMLPaths/CORE]: Path CONFIGDIR is C:\Users\dmoyf\AppData\Roaming\.minecraft\config [19May2024 20:33:51.689] [main/DEBUG] [net.minecraftforge.fml.loading.FMLPaths/CORE]: Path FMLCONFIG is C:\Users\dmoyf\AppData\Roaming\.minecraft\config\fml.toml
  • Topics

×
×
  • Create New...

Important Information

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