Posted January 28, 201411 yr I want my custom bow to render as the vanilla one do: https://dl.dropboxusercontent.com/u/184200482/img/bow_vanilla.png[/img] Instead of the way it renders now: https://dl.dropboxusercontent.com/u/184200482/img/bow_custom.png[/img] Here's the code: package SackCastellon.betterwood.items; import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import SackCastellon.betterwood.api.Tabs; import SackCastellon.betterwood.loader.LoreLoader; import SackCastellon.betterwood.reference.Reference; public class ItemBow extends net.minecraft.item.ItemBow { private final IIcon[] iconArray = new IIcon[3]; private final String material; private final String materialLore; private final String lore = LoreLoader.Material; public ItemBow(ItemPartMaterial material) { this.setCreativeTab(Tabs.tabBW); this.setMaxStackSize(1); this.setUnlocalizedName("Bow"); this.setMaxDamage(384); this.material = material.getMaterial(); this.materialLore = material.getLore(); } @SuppressWarnings({ "rawtypes", "unchecked" }) @Override public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean par4) { list.add(this.lore + ": " + this.materialLore); if (itemStack.isItemEnchanted()) { list.add(""); } } @Override public String getUnlocalizedName(ItemStack itemStack) { return super.getUnlocalizedName() + "." + this.material; } private String getPathForPull(int pull) { return Reference.TexturePath + "bow/" + pull + "/" + this.material; } @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon(this.getPathForPull(0)); for (int i = 0; i < 3; ++i) { this.iconArray[i] = iconRegister.registerIcon(this.getPathForPull(i + 1)); } } @Override public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { if(player.getItemInUse() == null) { return this.itemIcon; } int Pulling = stack.getMaxItemUseDuration() - useRemaining; if (Pulling >= 18) { return iconArray[2]; } else if (Pulling > 13) { return iconArray[1]; } else if (Pulling > 0) { return iconArray[0]; } return this.itemIcon; } } Thanks for helping
January 28, 201411 yr Author Use a IItemRenderer. I've been testing for a while but i didn't get the result i wanted. So, could you recommend me a good tutorial or else? Thanks.
January 28, 201411 yr Like Bantasaurusrex said... Use a IItemRenderer. Get the texture binding for items, then use Tesselator and GL11 for rendering. Remember to *implement IItemRenderer*
January 29, 201411 yr Hi THis link might be of use http://greyminecraftcoder.blogspot.com.au/2013/08/rendering-third-person-view-items.html .isFull3D() affects the item orientation as per the screenshots. -TGG
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.