Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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;

 

 

 

}

}

}

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;
	}
}

}

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.