Having a slight error with making custom armor. I'm trying to create custom armor for my mod, but I can't give it custom durability, resistance etc.
Here's the code in the armor's class for it:
I've already looked up a few other tutorials relating to adding custom armor in an attempt to solve the problem, and one referred to adding 'import net.minecraft.items.EnumArmorMaterial'. When I added this, it came up with an error because it couldn't find it (I suspect my problem lies here).
I'm using Eclipse Juno 4.2.2 and Forge 1.7.10-10.13.2.1277
Rollback Post to RevisionRollBack
Developer for Minecraft: Combat Evolved, a Halo mod. Complete with 3D weapons and is multiplayer-capatible!
Here's the code in the armor's class for it:
[/p] [p]package com.gruntxproductions.mce.armor;[/p] [p]import com.gruntxproductions.mce.MinecraftCombatEvolved;[/p] [p]import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.EnumHelper;[/p] [p]public class OdstArmour extends ItemArmor{ private String [] armourTypes = new String [] {"OdstHelmet", "OdstChest", "OdstLeggings", "OdstBoots"}; public OdstArmour(ArmorMaterial armorMaterial, int renderIndex, int armourtype) { super(armorMaterial, renderIndex, armourtype); } @Override public String getArmorTexture(ItemStack armor, Entity entity, int slot, String type){ return "mce:odst.png"; } public boolean isEquipped(EntityPlayer player) { return (player.inventory.armorInventory[3] != null && player.inventory.armorInventory[3].getItem() instanceof OdstArmour && player.inventory.armorInventory[2] != null && player.inventory.armorInventory[2].getItem() instanceof OdstArmour && player.inventory.armorInventory[1] != null && player.inventory.armorInventory[1].getItem() instanceof OdstArmour && player.inventory.armorInventory[0] != null && player.inventory.armorInventory[0].getItem() instanceof OdstArmour ); } }[/p] [p]And here's the code relating to the armor in the Main.
[/p] [p]package com.gruntxproductions.mce;[/p] [p]import com.gruntxproductions.blocks.multiplayer.BlockPlayerSpawn; import com.gruntxproductions.blocks.multiplayer.BlockWeaponSpawn; import com.gruntxproductions.blocks.multiplayer.TileEntityPlayerSpawn; import com.gruntxproductions.blocks.multiplayer.TileEntityWeaponSpawn; import com.gruntxproductions.mce.armor.EvaArmor; import com.gruntxproductions.mce.armor.OdstArmour; import com.gruntxproductions.mce.armor.ReconArmor; import com.gruntxproductions.mce.armor.SpartanArmor; import com.gruntxproductions.mce.blocks.BlockForerunner; import com.gruntxproductions.mce.blocks.BlockForerunnerCannonMan; import com.gruntxproductions.mce.blocks.BlockForerunnerGravityLift; import com.gruntxproductions.mce.blocks.BlockGeneric; import com.gruntxproductions.mce.blocks.GenericMetal; import com.gruntxproductions.mce.blocks.GreenFire; import com.gruntxproductions.mce.blocks.BlockHardLight; import com.gruntxproductions.mce.blocks.HardLightEmitter; import com.gruntxproductions.mce.commands.CommandCustomGame; import com.gruntxproductions.mce.commands.CommandICBMLaunch; import com.gruntxproductions.mce.creativetabs.BlocksTabs; import com.gruntxproductions.mce.creativetabs.WeaponsTabs; import com.gruntxproductions.mce.entities.EntityBluePlasmaBolt; import com.gruntxproductions.mce.entities.EntityBomb; import com.gruntxproductions.mce.entities.EntityBomber; import com.gruntxproductions.mce.entities.EntityBullet; import com.gruntxproductions.mce.entities.EntityCarbineBullet; import com.gruntxproductions.mce.entities.EntityContrail; import com.gruntxproductions.mce.entities.EntityDemolitionCharge; import com.gruntxproductions.mce.entities.EntityForerunnerGravitron; import com.gruntxproductions.mce.entities.EntityFuelRod; import com.gruntxproductions.mce.entities.EntityGreenPlasmaBolt; import com.gruntxproductions.mce.entities.EntityICBM; import com.gruntxproductions.mce.entities.EntityMirv; import com.gruntxproductions.mce.entities.EntityNeedle; import com.gruntxproductions.mce.entities.EntityPellet; import com.gruntxproductions.mce.entities.EntityPlasmaLance; import com.gruntxproductions.mce.entities.EntityProjectile; import com.gruntxproductions.mce.entities.EntityRocket; import com.gruntxproductions.mce.entities.EntitySniperBullet; import com.gruntxproductions.mce.items.GenericItem; import com.gruntxproductions.mce.items.ItemDemolitionCharge; import com.gruntxproductions.mce.items.ItemDetonator; import com.gruntxproductions.mce.items.ItemGhost; import com.gruntxproductions.mce.items.ItemLongsword; import com.gruntxproductions.mce.items.ItemTestICBMLaunch; import com.gruntxproductions.mce.items.UNSCsword; import com.gruntxproductions.mce.items.WeaponClip; import com.gruntxproductions.mce.networking.CustomGameInfoPacket; import com.gruntxproductions.mce.networking.PacketPipeline; import com.gruntxproductions.mce.networking.RecoilPacket; import com.gruntxproductions.mce.networking.SoundPacket; import com.gruntxproductions.mce.networking.VehicleVelocityPacket; import com.gruntxproductions.mce.ores.GenericOre; import com.gruntxproductions.mce.structures.Structure; import com.gruntxproductions.mce.structures.StructureGenerator; import com.gruntxproductions.mce.vehicles.VehicleGhost; import com.gruntxproductions.mce.vehicles.VehicleLongsword; import com.gruntxproductions.mce.weapons.*;[/p] [p]import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.EntityRenderer; import net.minecraft.command.ServerCommandManager; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityTracker; import net.minecraft.entity.EntityTrackerEntry; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraft.server.MinecraftServer; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.ModClassLoader; import cpw.mods.fml.common.ObfuscationReflectionHelper; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLServerStartingEvent; import cpw.mods.fml.common.gameevent.TickEvent; import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; import net.minecraftforge.common.util.EnumHelper;[/p] [p]public static ArmorMaterial EnumArmorMaterial = EnumHelper.addArmorMaterial("Odst", 25, new int[]{4, 7, 4, 2}, 7);[/p] [p]public static Item odstHelmet = new OdstArmour(ArmorMaterial.IRON, 0, 0).setTextureName("mce:odstHelmet").setCreativeTab(MinecraftCombatEvolved.weaponsTabs).setUnlocalizedName("odstHelmet"); public static Item odstChest = new OdstArmour(ArmorMaterial.IRON, 0, 1).setTextureName("mce:odstChest").setCreativeTab(MinecraftCombatEvolved.weaponsTabs).setUnlocalizedName("odstChest"); public static Item odstLeggings = new OdstArmour(ArmorMaterial.IRON, 0, 2).setTextureName("mce:odstLeggings").setCreativeTab(MinecraftCombatEvolved.weaponsTabs).setUnlocalizedName("odstLeggings"); public static Item odstBoots = new OdstArmour(ArmorMaterial.IRON, 0, 3).setTextureName("mce:odstBoots").setCreativeTab(MinecraftCombatEvolved.weaponsTabs).setUnlocalizedName("odstBoots");[/p] [p]GameRegistry.registerItem(odstHelmet, "odstHelmet"); GameRegistry.registerItem(odstChest, "odstChest"); GameRegistry.registerItem(odstLeggings, "odstLeggings"); GameRegistry.registerItem(odstBoots, "odstBoots");[/p] [p]I've already looked up a few other tutorials relating to adding custom armor in an attempt to solve the problem, and one referred to adding 'import net.minecraft.items.EnumArmorMaterial'. When I added this, it came up with an error because it couldn't find it (I suspect my problem lies here).
I'm using Eclipse Juno 4.2.2 and Forge 1.7.10-10.13.2.1277
I have a little document I made up out of what was supposed to be my forum post, but the forums were being crappy to me... so, here you go:
Armor Help
Best of luck!