Fix rendering of blueprints and templates

This commit is contained in:
Raul Tambre 2014-05-04 22:34:26 +03:00
parent 049f9c41ba
commit efecafdf9a
2 changed files with 9 additions and 5 deletions

View file

@ -18,7 +18,6 @@ import cpw.mods.fml.relauncher.SideOnly;
import buildcraft.core.utils.NBTUtils; import buildcraft.core.utils.NBTUtils;
public class ItemBlueprintStandard extends ItemBlueprint { public class ItemBlueprintStandard extends ItemBlueprint {
private IIcon cleanBlueprint; private IIcon cleanBlueprint;
private IIcon usedBlueprint; private IIcon usedBlueprint;
@ -29,9 +28,11 @@ public class ItemBlueprintStandard extends ItemBlueprint {
@Override @Override
public IIcon getIconIndex(ItemStack stack) { public IIcon getIconIndex(ItemStack stack) {
if (!NBTUtils.getItemData(stack).hasKey("name")) { if (!NBTUtils.getItemData(stack).hasKey("name")) {
return cleanBlueprint; itemIcon = cleanBlueprint;
return itemIcon;
} else { } else {
return usedBlueprint; itemIcon = usedBlueprint;
return itemIcon;
} }
} }

View file

@ -18,6 +18,7 @@ import cpw.mods.fml.relauncher.SideOnly;
import buildcraft.core.utils.NBTUtils; import buildcraft.core.utils.NBTUtils;
public class ItemBlueprintTemplate extends ItemBlueprint { public class ItemBlueprintTemplate extends ItemBlueprint {
private IIcon cleanTemplate;
private IIcon usedTemplate; private IIcon usedTemplate;
public ItemBlueprintTemplate() { public ItemBlueprintTemplate() {
@ -27,16 +28,18 @@ public class ItemBlueprintTemplate extends ItemBlueprint {
@Override @Override
public IIcon getIconIndex(ItemStack stack) { public IIcon getIconIndex(ItemStack stack) {
if (!NBTUtils.getItemData(stack).hasKey("name")) { if (!NBTUtils.getItemData(stack).hasKey("name")) {
itemIcon = cleanTemplate;
return itemIcon; return itemIcon;
} else { } else {
return usedTemplate; itemIcon = usedTemplate;
return itemIcon;
} }
} }
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister) { public void registerIcons(IIconRegister par1IconRegister) {
itemIcon = par1IconRegister.registerIcon("buildcraft:template_clean"); cleanTemplate = par1IconRegister.registerIcon("buildcraft:template_clean");
usedTemplate = par1IconRegister.registerIcon("buildcraft:template_used"); usedTemplate = par1IconRegister.registerIcon("buildcraft:template_used");
} }
} }