Jump to content

[1.7.10][SOLVED!] Armor not working!


MrJPGames

Recommended Posts

Ok, so as of recentry I started updating this mod I made about 1 1/2 years ago. It took quite a bit of time but I am incapable of making the armor function. It renders correctly but the little armor icons above the health only show 1 armor piece and only from the helmet!

 

The Material:

public static ArmorMaterial armorOBSIDIAN = EnumHelperClient.addArmorMaterial("OBSIDIAN",66, new int[]{3, 8, 6, 3}, 30);

 

The items in mod file:

public static final Item helmetObsidian = (new MT_ItemArmor(armorOBSIDIAN, 0, helmetOID)).setUnlocalizedName("helmetObsidian");
    public static final Item plateObsidian = (new MT_ItemArmor(armorOBSIDIAN, 1, chestplateOID)).setUnlocalizedName("chestplateObsidian");
    public static final Item legsObsidian = (new MT_ItemArmor(armorOBSIDIAN, 2, legsOID)).setUnlocalizedName("leggingsObsidian");
    public static final Item bootsObsidian = (new MT_ItemArmor(armorOBSIDIAN, 3, bootsOID)).setUnlocalizedName("bootsObsidian");
    

 

MT_ItemArmor:

package MoreTools;

import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;

public class MT_ItemArmor extends ItemArmor{

public MT_ItemArmor(ArmorMaterial material, int placement, int id) {
	super(MT_mod.armorCOPPER, id, placement);
	setCreativeTab(CreativeTabs.tabCombat);
}

public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type){
	if (stack.getItem() == MT_mod.helmetCopper || stack.getItem() == MT_mod.plateCopper || stack.getItem() == MT_mod.bootsCopper){
		return "moretools:textures/models/armor/Copper_1.png";
	}
	if (stack.getItem() == MT_mod.legsCopper){
		return "moretools:textures/models/armor/Copper_2.png";
	}
	if (stack.getItem() == MT_mod.helmetEmerald || stack.getItem() == MT_mod.plateEmerald || stack.getItem() == MT_mod.bootEmerald){
		return "moretools:textures/models/armor/Emerald_1.png";
	}
	if (stack.getItem() == MT_mod.legsEmerald){
		return "moretools:textures/models/armor/Emerald_2.png";
	}
	if (stack.getItem() == MT_mod.helmetNetherDiamond || stack.getItem() == MT_mod.plateNetherDiamond || stack.getItem() == MT_mod.bootNetherDiamond){
		return "moretools:textures/models/armor/NetherDiamond_1.png";
	}
	if (stack.getItem() == MT_mod.legsNetherDiamond){
		return "moretools:textures/models/armor/NetherDiamond_2.png";
	}
	if (stack.getItem() == MT_mod.helmetObsidian || stack.getItem() == MT_mod.plateObsidian || stack.getItem() == MT_mod.bootsObsidian){
		return "moretools:textures/models/armor/Obsidian_1.png";
	}
	if (stack.getItem() == MT_mod.legsObsidian){
		return "moretools:textures/models/armor/Obsidian_2.png";
	}
	if (stack.getItem() == MT_mod.helmetRuby || stack.getItem() == MT_mod.plateRuby || stack.getItem() == MT_mod.bootsRuby){
		return "moretools:textures/models/armor/Ruby_1.png";
	}
	if (stack.getItem() == MT_mod.legsRuby){
		return "moretools:textures/models/armor/Ruby_2.png";
	}
	if (stack.getItem() == MT_mod.helmetSandstone || stack.getItem() == MT_mod.plateSandstone || stack.getItem() == MT_mod.bootSandstone){
		return "moretools:textures/models/armor/Sandstone_1.png";
	}
	if (stack.getItem() == MT_mod.legsSandstone){
		return "moretools:textures/models/armor/Sandstone_2.png";
	}
	if (stack.getItem() == MT_mod.helmetSapphire || stack.getItem() == MT_mod.plateSapphire || stack.getItem() == MT_mod.bootSapphire){
		return "moretools:textures/models/armor/Sapphire_1.png";
	}
	if (stack.getItem() == MT_mod.legsSapphire){
		return "moretools:textures/models/armor/Sapphire_2.png";
	}
	if (stack.getItem() == MT_mod.helmetSteel || stack.getItem() == MT_mod.plateSteel || stack.getItem() == MT_mod.bootsSteel){
		return "moretools:textures/models/armor/Steel_1.png";
	}
	if (stack.getItem() == MT_mod.legsSteel){
		return "moretools:textures/models/armor/Steel_2.png";
	}
	return null;
}
@Override
    public void registerIcons(IIconRegister par1IconRegister)
    {
    	this.itemIcon = par1IconRegister.registerIcon("moretools:" + this.getUnlocalizedName().substring(5));
    }
}

 

Does someone know how to make the armor function properly?!

I try not to be mean about your english (as my own isn't the best either) but sometimes I can't help myself!

If you get mad at me for this or any other reason, please look at the profile picture so you'll feel better (and pretier) than me!

Thanks.

Link to comment
Share on other sites

Thanks for the fast reply, and yes I could make the code simpler but I was only updating (from 1.4.7) to 1.7.10 to play with some friends somewhere next week so I probably will make it work however dirty the code (I didn't do a great job with clean code 1.5 years ago!).

 

So I changed the Enum code slightly (now uses EnumHelper instead of EnumHelperClient). But it still doesn't work! Here is the code:

static ArmorMaterial armorOBSIDIAN = EnumHelper.addArmorMaterial("OBSIDIAN",66, new int[]{3, 8, 6, 3}, 30);

 

Which doesn't look/function much diffrent from your (as far as i can see):

armorMaterialIMC = EnumHelper.addArmorMaterial("IMC", 33, new int[]{3, 8, 6, 3}, 10);

 

Yet it still doesn't work properly. I couldn't find any other causes (though maybe I'm just missing them). If you/anyone else needs another more code I would love to suply those. Direct help would be empriciated. FYI I'm curently using MCF : 1.7.10-10.13.0.1179

I try not to be mean about your english (as my own isn't the best either) but sometimes I can't help myself!

If you get mad at me for this or any other reason, please look at the profile picture so you'll feel better (and pretier) than me!

Thanks.

Link to comment
Share on other sites

Does anyone know what I am doing wrong, it's the only thing I can't get working. At this point it seems to me like I have tried evrything but I'm sure that I'm missing something!

 

As said before if you need more code I will obvs give that code as soons as I can!

I try not to be mean about your english (as my own isn't the best either) but sometimes I can't help myself!

If you get mad at me for this or any other reason, please look at the profile picture so you'll feel better (and pretier) than me!

Thanks.

Link to comment
Share on other sites

Is it just the armor bar rendering, or does the armor not function? If it's just the bar, you can try implementing ISpecialArmor to customize it.

 

I think that ISpecialArmor should be able to fix it. The armor seems to function as it should it's just the armor bar. After implementing ISpecialArmor I get 3 functions I haven't used before. The bar doesn't show at all (first it only showed with the helmet and incorectly) I think it has to do with everything returning null, or 0 but as I don't know what they should return I can't fix it.

 

The three functions are:

ArmorProperties, getArmorDisplay and damageArmor

 

I think getArmorDisplay should be it so now I would like to know how to implemt this (along side the other one as they make the original function of the armor not work as I have yet to test this after the changes!)

I try not to be mean about your english (as my own isn't the best either) but sometimes I can't help myself!

If you get mad at me for this or any other reason, please look at the profile picture so you'll feel better (and pretier) than me!

Thanks.

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

    • So I've read the EULA, and lets be straight...     If I split my modpack(of my mods, yeah I'm nuts) into several(many) individual mods(like just one boss) with minor additions(plus not working together), then have a complete/modpack version on patreon/onlyfans having each addon work together... Would people buy my idea?
    • German A1 – C1, TestDAF, Goethe B1, B2, C1, C2, valid GOETHE certificate German A1 – C1, TestDAF, Goethe B1, B2, C1, C2, valid GOETHE certificate(+27(838-80-8170
    • Done, it still crashed. New log https://paste.ee/p/kYv6e
    • I am migrating a mod from 1.16.5 to 1.20.2 The version for 1.16.5 can be found here https://github.com/beothorn/automataCraft For the block called automata_start, it uses TileEntities and has blockstates, model/block and textures on json files. This is currently working fine on 1.16.5 https://github.com/beothorn/automataCraft/tree/master/src/main/resources/assets/automata For 1.20.2 I migrated the logic from TileEntities to BlockEntity. The mod is working fine. All blocks and Items are working with the correct textures except for the textures for each state of the automata_start block. No changes where made to the json files. This is the branch I am working on (there were some refactorings, but all is basically the same): https://github.com/beothorn/automataCraft/tree/1_20/src/main/resources/assets/automata The only difference I can think that may be related is that i had to implement createBlockStateDefinition on the BaseEntityBlock: https://github.com/beothorn/automataCraft/blob/1_20/src/main/java/br/com/isageek/automata/automata/AutomataStartBlock.java#L43 This is driving me crazy. I know the jsons are being loaded as I put a breakpoint at `net.minecraft.client.resources.model.ModelBakery#loadModel` and I can see BlockModelDefinition.fromJsonElement being called with automata_start. I also printed the state from the arguments of the tick function call and they look correct (https://github.com/beothorn/automataCraft/blob/1_20/src/main/java/br/com/isageek/automata/automata/Ticker.java#L32 ): blockState Block{automata:automata_start}[state=loadreplaceables] In game, all I see is the no textures. I think it is weird it is not the "missing texture" texture so I think it may be related to the material, but I had no success tweaking it (https://github.com/beothorn/automataCraft/blob/1_20/src/main/java/br/com/isageek/automata/automata/AutomataStartBlock.java#L37).   public static final Property<AutomataStartState> state = EnumProperty.create("state", AutomataStartState.class); private final AtomicReference<RegistryObject<BlockEntityType<?>>> blockEntityType; private final Map<String, RegistryObject<Block>> registeredBlocks; public AutomataStartBlock( final AtomicReference<RegistryObject<BlockEntityType<?>>> blockEntityType, final Map<String, RegistryObject<Block>> registeredBlocks ) { super(BlockBehaviour.Properties.of().mapColor(MapColor.STONE).strength(1.5F, 6.0F)); this.blockEntityType = blockEntityType; this.registeredBlocks = registeredBlocks; this.registerDefaultState(this.getStateDefinition().any().setValue(state, AutomataStartState.LOAD_REPLACEABLES)); } @Override protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> stateBuilder) { stateBuilder.add(state); }     So my cry for help is, anyone has any ideas? Is there a way to easily debug this, for example somewhere where I can list the textures for a given state, or make sure this is loaded?   Thanks in advance for the hints
    • FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring root project 'forge-1.8.9-11.15.1.2318-1.8.9-mdk'. > Could not resolve all dependencies for configuration ':classpath'. > Could not resolve net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT. Required by: :forge-1.8.9-11.15.1.2318-1.8.9-mdk:unspecified > Could not resolve net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT. > Unable to load Maven meta-data from https://jcenter.bintray.com/net/minecraftforge/gradle/ForgeGradle/2.1-SNAPSHOT/maven-metadata.xml. > Could not GET 'https://jcenter.bintray.com/net/minecraftforge/gradle/ForgeGradle/2.1-SNAPSHOT/maven-metadata.xml'. > peer not authenticated > Could not resolve net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT. > Unable to load Maven meta-data from http://files.minecraftforge.net/maven/net/minecraftforge/gradle/ForgeGradle/2.1-SNAPSHOT/maven-metadata.xml. > Could not GET 'http://files.minecraftforge.net/maven/net/minecraftforge/gradle/ForgeGradle/2.1-SNAPSHOT/maven-metadata.xml'. > peer not authenticated * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED Total time: 2.78 secs This is the error I got. Any help would be appreciated!
  • Topics

×
×
  • Create New...

Important Information

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