Guard against IOOBEs when rendering the new spell trade icon, fixes #565
This commit is contained in:
@@ -90,6 +90,8 @@ public class WizardTradeTweaksHandler {
|
|||||||
// New spell indicator
|
// New spell indicator
|
||||||
if(gui.inventorySlots instanceof ContainerMerchant){
|
if(gui.inventorySlots instanceof ContainerMerchant){
|
||||||
|
|
||||||
|
if(tradeIndex < trades.size()){ // Seems to happen with certain mods' GUIs
|
||||||
|
|
||||||
// Can't use getCurrentRecipe because that only gets updated when the correct items are given
|
// Can't use getCurrentRecipe because that only gets updated when the correct items are given
|
||||||
MerchantRecipe recipe = trades.get(tradeIndex);
|
MerchantRecipe recipe = trades.get(tradeIndex);
|
||||||
|
|
||||||
@@ -108,7 +110,7 @@ public class WizardTradeTweaksHandler {
|
|||||||
GlStateManager.color(1, 1, 1);
|
GlStateManager.color(1, 1, 1);
|
||||||
Minecraft.getMinecraft().renderEngine.bindTexture(NEW_SPELL_ICON);
|
Minecraft.getMinecraft().renderEngine.bindTexture(NEW_SPELL_ICON);
|
||||||
|
|
||||||
int frame = Math.max(player.ticksExisted/ANIMATION_FRAME_TIME % ANIMATION_PERIOD - (ANIMATION_PERIOD - ANIMATION_FRAMES), 0);
|
int frame = Math.max(player.ticksExisted / ANIMATION_FRAME_TIME % ANIMATION_PERIOD - (ANIMATION_PERIOD - ANIMATION_FRAMES), 0);
|
||||||
DrawingUtils.drawTexturedRect(x, y, 0, frame * ICON_HEIGHT, ICON_WIDTH, ICON_HEIGHT, ICON_WIDTH, ICON_HEIGHT * ANIMATION_FRAMES);
|
DrawingUtils.drawTexturedRect(x, y, 0, frame * ICON_HEIGHT, ICON_WIDTH, ICON_HEIGHT, ICON_WIDTH, ICON_HEIGHT * ANIMATION_FRAMES);
|
||||||
|
|
||||||
RenderHelper.disableStandardItemLighting();
|
RenderHelper.disableStandardItemLighting();
|
||||||
@@ -125,5 +127,6 @@ public class WizardTradeTweaksHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user