Hello. I have created a food item that is very similar to the Golden apple in how it works.
Code:
Whenever I run the game the model and texture for the 2nd apple isn't showing.
Picture:
http://www.mediafire.com/convkey/90e2/gbo2r0eox4lorfnzg.jpg
The regular Silver Apple doesn't have any model or texture problems. Does anyone know how to fix this?
Code:
Click to reveal
import java.util.List;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import quplet.moreMaterials.mod.Reference;
public class ItemSilverApple extends ItemFood {
public ItemSilverApple() {
super(4, 1.0F, false);
setUnlocalizedName(Reference.ModItems.SILVER_APPLE.getUnlocalizedName());
setRegistryName(Reference.ModItems.SILVER_APPLE.getRegistryName());
setCreativeTab(CreativeTabs.FOOD);
setAlwaysEdible();
setHasSubtypes(true);
}
public boolean hasEffect(ItemStack stack) {
return stack.getMetadata() > 0;
}
public EnumRarity getRarity(ItemStack stack)
{
return stack.getMetadata() == 0 ? EnumRarity.UNCOMMON : EnumRarity.RARE;
}
public void onFoodEaten(ItemStack stack, World worldIn, EntityPlayer player)
{
if(!worldIn.isRemote) {
if(stack.getMetadata() > 0) {
player.addPotionEffect(new PotionEffect(MobEffects.HASTE, 3000, 1));
player.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, 1250, 1));
player.addPotionEffect(new PotionEffect(MobEffects.NIGHT_VISION, 3000, 0));
}
else {
player.addPotionEffect(new PotionEffect(MobEffects.HASTE, 750, 1));
player.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, 500, 0));
}
}
}
public void getSubItems(Item itemIn, CreativeTabs tab, List<ItemStack> subItems)
{
subItems.add(new ItemStack(itemIn));
subItems.add(new ItemStack(itemIn, 1, 1));
}
}
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import quplet.moreMaterials.mod.Reference;
public class ItemSilverApple extends ItemFood {
public ItemSilverApple() {
super(4, 1.0F, false);
setUnlocalizedName(Reference.ModItems.SILVER_APPLE.getUnlocalizedName());
setRegistryName(Reference.ModItems.SILVER_APPLE.getRegistryName());
setCreativeTab(CreativeTabs.FOOD);
setAlwaysEdible();
setHasSubtypes(true);
}
public boolean hasEffect(ItemStack stack) {
return stack.getMetadata() > 0;
}
public EnumRarity getRarity(ItemStack stack)
{
return stack.getMetadata() == 0 ? EnumRarity.UNCOMMON : EnumRarity.RARE;
}
public void onFoodEaten(ItemStack stack, World worldIn, EntityPlayer player)
{
if(!worldIn.isRemote) {
if(stack.getMetadata() > 0) {
player.addPotionEffect(new PotionEffect(MobEffects.HASTE, 3000, 1));
player.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, 1250, 1));
player.addPotionEffect(new PotionEffect(MobEffects.NIGHT_VISION, 3000, 0));
}
else {
player.addPotionEffect(new PotionEffect(MobEffects.HASTE, 750, 1));
player.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, 500, 0));
}
}
}
public void getSubItems(Item itemIn, CreativeTabs tab, List<ItemStack> subItems)
{
subItems.add(new ItemStack(itemIn));
subItems.add(new ItemStack(itemIn, 1, 1));
}
}
Whenever I run the game the model and texture for the 2nd apple isn't showing.
Picture:
http://www.mediafire.com/convkey/90e2/gbo2r0eox4lorfnzg.jpg
The regular Silver Apple doesn't have any model or texture problems. Does anyone know how to fix this?
Create an account or sign in to comment.
5
1
you forgot the
setTextureName();
1
Oh sorry, thought this was a different issue I was looking at. For this I think though the texture might be in the Json, it still might not be in the assets properly. Check that out.
1
Maybe it wasn't configured right? That issue has happened to me before mainly because the values (hunger points, damage, etc) weren't input correctly