Jump to content

Recommended Posts

Posted

hi i write on my mod and add armor but if i wrote this and "0,1,2,3" is red (Type mismatch:Cannot convert from int to EntityEquipmentSlot") what do i wrong?:

 

 

 

package com.PlasticMod.items;

 

import net.minecraft.inventory.EntityEquipmentSlot;

import net.minecraft.item.ItemArmor;

 

public class ItemPlasticArmor<IconRegister> extends ItemArmor{

 

public ItemPlasticArmor(ArmorMaterial materialIn, int renderIndexIn, EntityEquipmentSlot equipmentSlotIn) {

super(materialIn, renderIndexIn, equipmentSlotIn);

 

switch(armorType){

 

case 0:setUnlocalizedName("plastichelmet"); break;

case 1:setUnlocalizedName("plasticchest"); break;

case 2:setUnlocalizedName("plasticlegs"); break;

case 3:setUnlocalizedName("plasticboots"); break;

 

 

 

}

}

}

Posted

First: put it in a code field

Second: It should look a little like this

public class ItemPlasticArmor extends ItemArmor {

public ItemPlasticArmor(ArmorMaterial materialIn, EntityEquipmentSlot equipmentSlotIn, String name) {
	super(materialIn, 0, equipmentSlotIn);
                this.setUnlocalizedName(name);
	this.setRegistryName(name);
}

public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) {
	if (slot == EntityEquipmentSlot.HEAD || slot == EntityEquipmentSlot.CHEST || slot == EntityEquipmentSlot.FEET) {
		return "ID:textures/models/armor/armor_layer_1.png";
	} else if (slot == EntityEquipmentSlot.LEGS) {
		return "ID:textures/models/armor/armor_layer_2.png";
	} else {
		return null;
	}
}

}

Posted

And then in your items class it would be something like this:

public class PlasticItems {
public static ArmorMaterial plastic_armor_material;
public static Item PLASTIC_HELMET;
public static Item PLASTIC_CHESTPLATE;
public static Item PLASTIC_LEGGINGS;
public static Item PLASTIC_BOOTS;

public static void init() {
	plastic_armor_material = EnumHelper.addArmorMaterial("plastic_armor_material", "", 473, new int[] {3, 6, 8, 3}, 17, SoundEvents.ENTITY_EGG_THROW, 3);
	PLASTIC_HELMET = new ItemPlasticArmor(plastic_armor_material, EntityEquipmentSlot.HEAD, "plastic_helmet").setCreativeTab(CreativeTabs.COMBAT);
	PLASTIC_CHESTPLATE = new ItemPlasticArmor(plastic_armor_material, EntityEquipmentSlot.CHEST, "plastic_chestplate").setCreativeTab(CreativeTabs.COMBAT);
	PLASTIC_LEGGINGS = new ItemPlasticArmor(plastic_armor_material, EntityEquipmentSlot.LEGS, "plastic_leggings").setCreativeTab(CreativeTabs.COMBAT);
	PLASTIC_BOOTS = new ItemPlasticArmor(plastic_armor_material, EntityEquipmentSlot.FEET, "plastic_boots").setCreativeTab(CreativeTabs.COMBAT);
}

public static void register() {
	GameRegistry.register(PLASTIC_HELMET);
	GameRegistry.register(PLASTIC_CHESTPLATE);
	GameRegistry.register(PLASTIC_LEGGINGS);
	GameRegistry.register(PLASTIC_BOOTS);
}
}

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



×
×
  • Create New...

Important Information

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