diff --git a/src/main/java/malte0811/industrialwires/client/ClientProxy.java b/src/main/java/malte0811/industrialwires/client/ClientProxy.java index c552f81..24fcf73 100644 --- a/src/main/java/malte0811/industrialwires/client/ClientProxy.java +++ b/src/main/java/malte0811/industrialwires/client/ClientProxy.java @@ -470,7 +470,8 @@ public class ClientProxy extends CommonProxy { IBakedModel texModel = Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(stack, null, null); TextureAtlasSprite sprite = texModel.getParticleTexture(); - if (sprite.hasAnimationMetadata()) { + //noinspection ConstantConditions + if (sprite == null || sprite.hasAnimationMetadata()) { return false; } int[][] data = sprite.getFrameTextureData(0); diff --git a/src/main/java/malte0811/industrialwires/crafting/RecipePanelTexture.java b/src/main/java/malte0811/industrialwires/crafting/RecipePanelTexture.java index 7e6d49e..58ec10c 100644 --- a/src/main/java/malte0811/industrialwires/crafting/RecipePanelTexture.java +++ b/src/main/java/malte0811/industrialwires/crafting/RecipePanelTexture.java @@ -34,7 +34,7 @@ import javax.annotation.Nonnull; public class RecipePanelTexture extends IForgeRegistryEntry.Impl implements IRecipe { @Override public boolean matches(@Nonnull InventoryCrafting inv, @Nonnull World worldIn) { - boolean foundTexture = false; + int texX = -1, texY = -1; boolean foundPanel = false; for (int x = 0; x < inv.getWidth(); x++) { for (int y = 0; y < inv.getHeight(); y++) { @@ -44,18 +44,23 @@ public class RecipePanelTexture extends IForgeRegistryEntry.Impl implem return false; } foundPanel = true; - } else if (IndustrialWires.proxy.isValidTextureSource(here)) { - if (foundTexture || (here.getItem() == Item.getItemFromBlock(IndustrialWires.panel) - && here.getMetadata() != BlockTypes_Panel.DUMMY.ordinal())) { + } else if (!here.isEmpty()) { + if (texX == -1) { + texX = x; + texY = y; + } else { return false; } - foundTexture = true; - } else if (!here.isEmpty()) { - return false; } } } - return foundPanel && foundTexture; + if (!foundPanel || texX == -1) { + return false; + } + ItemStack texSource = inv.getStackInRowAndColumn(texX, texY); + return IndustrialWires.proxy.isValidTextureSource(texSource) && + (texSource.getItem() != Item.getItemFromBlock(IndustrialWires.panel) + || texSource.getMetadata() == BlockTypes_Panel.DUMMY.ordinal()); } private boolean isUnfinishedPanel(ItemStack stack) {