1

Need help with this error.

Quplet's Avatar Quplet7/6/16 2:14 pm
1 emeralds 331 5
7/18/2016 3:14 pm
jtrent238's Avatar jtrent238
Hello. I have created a food item that is very similar to the Golden apple in how it works.
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));
}

}

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?
Posted by Quplet's Avatar
Quplet
Level 18 : Journeyman Modder
45

Create an account or sign in to comment.

5

1
07/18/2016 3:14 pm
Level 67 : High Grandmaster Modder
jtrent238
jtrent238's Avatar
you forgot the

setTextureName();
1
07/09/2016 10:56 pm
Level 7 : Apprentice Crafter
jalen1563
jalen1563's Avatar
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
07/09/2016 10:55 pm
Level 7 : Apprentice Crafter
jalen1563
jalen1563's Avatar
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
1
07/06/2016 2:59 pm
Level 56 : Grandmaster Technomancer
infered5
infered5's Avatar
Is it possible you didn't include the texture when you built the Jar?
1
07/06/2016 3:03 pm
Level 18 : Journeyman Modder
Quplet
Quplet's Avatar
No, the texture is there along with the .json file.
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome