Skip to content

Commit

Permalink
Fix bows replacing the wrong texture when broken
Browse files Browse the repository at this point in the history
  • Loading branch information
bonii-xx committed Nov 21, 2014
1 parent 81da663 commit 3c7d9f0
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions src/main/java/tconstruct/library/weaponry/ProjectileWeapon.java
Expand Up @@ -282,6 +282,49 @@ protected IIcon getCorrectAnimationIcon(Map<Integer, IIcon[]> icons, int id, flo
return icons.get(-1)[step];
}

@Override
@SideOnly(Side.CLIENT)
// exactly the same as the ToolCore one but with broken check for Handle instead of Head
public IIcon getIcon (ItemStack stack, int renderPass)
{
NBTTagCompound tags = stack.getTagCompound();

if (tags != null)
{
tags = stack.getTagCompound().getCompoundTag("InfiTool");
if (renderPass < getPartAmount())
{
// Handle
if (renderPass == 0) {
if (tags.getBoolean("Broken"))
return getCorrectIcon(brokenIcons, tags.getInteger("RenderHandle"));
else
return getCorrectIcon(handleIcons, tags.getInteger("RenderHandle"));
}
// Head
else if (renderPass == 1)
{
return getCorrectIcon(headIcons, tags.getInteger("RenderHead"));
}
// Accessory
else if (renderPass == 2)
return getCorrectIcon(accessoryIcons, tags.getInteger("RenderAccessory"));
// Extra
else if (renderPass == 3)
return getCorrectIcon(extraIcons, tags.getInteger("RenderExtra"));
}
// Effects
else if (renderPass <= 10)
{
String effect = "Effect" + (1 + renderPass - getPartAmount());
if(tags.hasKey(effect))
return effectIcons.get(tags.getInteger(effect));
}
return blankSprite;
}
return emptyIcon;
}

@Override
public void registerIcons(IIconRegister iconRegister) {
super.registerIcons(iconRegister);
Expand Down

0 comments on commit 3c7d9f0

Please sign in to comment.