mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +01:00
Fix a bug with the book crashing if you had a recipe disabled
This commit is contained in:
parent
4e2d2dd2a4
commit
bf4d49941f
1 changed files with 3 additions and 3 deletions
|
@ -51,7 +51,7 @@ public class PageCrafting extends BookletPageAA{
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
public void renderPre(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
||||||
if(this.recipes[this.recipePos] != null){
|
if(this.recipes != null && this.recipes.length > 0 && this.recipes[this.recipePos] != null){
|
||||||
Minecraft.getMinecraft().getTextureManager().bindTexture(GuiBooklet.RES_LOC);
|
Minecraft.getMinecraft().getTextureManager().bindTexture(GuiBooklet.RES_LOC);
|
||||||
gui.drawRect(gui.getGuiLeft()+27, gui.getGuiTop()+20, 146, 20, 99, 60);
|
gui.drawRect(gui.getGuiLeft()+27, gui.getGuiTop()+20, 146, 20, 99, 60);
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ public class PageCrafting extends BookletPageAA{
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void render(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
public void render(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){
|
||||||
IRecipe recipe = this.recipes[this.recipePos];
|
IRecipe recipe = this.recipes != null && this.recipes.length > 0 ? this.recipes[this.recipePos] : null;
|
||||||
|
|
||||||
if(recipe == null){
|
if(recipe == null){
|
||||||
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, TextFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID+".recipeDisabled"), gui.getGuiLeft()+14, gui.getGuiTop()+15, 115, 0, false);
|
StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, TextFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID+".recipeDisabled"), gui.getGuiLeft()+14, gui.getGuiTop()+15, 115, 0, false);
|
||||||
|
@ -179,7 +179,7 @@ public class PageCrafting extends BookletPageAA{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack[] getItemStacksForPage(){
|
public ItemStack[] getItemStacksForPage(){
|
||||||
if(this.recipes != null){
|
if(this.recipes != null && this.recipes.length > 0){
|
||||||
ItemStack[] stacks = new ItemStack[this.recipes.length];
|
ItemStack[] stacks = new ItemStack[this.recipes.length];
|
||||||
for(int i = 0; i < this.recipes.length; i++){
|
for(int i = 0; i < this.recipes.length; i++){
|
||||||
if(this.recipes[i] != null){
|
if(this.recipes[i] != null){
|
||||||
|
|
Loading…
Reference in a new issue