mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 08:48:34 +01:00
Added some Null Checks for stuffs
This commit is contained in:
parent
7b9573ca8e
commit
96581ba7cf
5 changed files with 19 additions and 10 deletions
|
@ -41,6 +41,21 @@ public class BookletPage{
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addToPagesWithItemStackData(){
|
||||||
|
if(!InitBooklet.pagesWithItemStackData.contains(this)){
|
||||||
|
ItemStack[] stacks = this.getItemStacksForPage();
|
||||||
|
if(stacks != null && stacks.length > 0){
|
||||||
|
//Ensure that there is at least one ItemStack
|
||||||
|
for(ItemStack stack : stacks){
|
||||||
|
if(stack != null){
|
||||||
|
InitBooklet.pagesWithItemStackData.add(this);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void renderItem(GuiBooklet gui, ItemStack stack, int x, int y, float scale){
|
public static void renderItem(GuiBooklet gui, ItemStack stack, int x, int y, float scale){
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
GL11.glEnable(GL11.GL_BLEND);
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
|
|
|
@ -12,7 +12,6 @@ package ellpeck.actuallyadditions.booklet.page;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||||
import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
||||||
import ellpeck.actuallyadditions.booklet.InitBooklet;
|
|
||||||
import ellpeck.actuallyadditions.proxy.ClientProxy;
|
import ellpeck.actuallyadditions.proxy.ClientProxy;
|
||||||
import ellpeck.actuallyadditions.util.ModUtil;
|
import ellpeck.actuallyadditions.util.ModUtil;
|
||||||
import ellpeck.actuallyadditions.util.StringUtil;
|
import ellpeck.actuallyadditions.util.StringUtil;
|
||||||
|
@ -40,7 +39,7 @@ public class PageCrafting extends BookletPage{
|
||||||
public PageCrafting(int id, IRecipe... recipes){
|
public PageCrafting(int id, IRecipe... recipes){
|
||||||
super(id);
|
super(id);
|
||||||
this.recipes = recipes;
|
this.recipes = recipes;
|
||||||
InitBooklet.pagesWithItemStackData.add(this);
|
this.addToPagesWithItemStackData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
package ellpeck.actuallyadditions.booklet.page;
|
package ellpeck.actuallyadditions.booklet.page;
|
||||||
|
|
||||||
import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
||||||
import ellpeck.actuallyadditions.booklet.InitBooklet;
|
|
||||||
import ellpeck.actuallyadditions.proxy.ClientProxy;
|
import ellpeck.actuallyadditions.proxy.ClientProxy;
|
||||||
import ellpeck.actuallyadditions.recipe.CrusherRecipeRegistry;
|
import ellpeck.actuallyadditions.recipe.CrusherRecipeRegistry;
|
||||||
import ellpeck.actuallyadditions.util.ModUtil;
|
import ellpeck.actuallyadditions.util.ModUtil;
|
||||||
|
@ -34,7 +33,7 @@ public class PageCrusherRecipe extends BookletPage{
|
||||||
public PageCrusherRecipe(int id, CrusherRecipeRegistry.CrusherRecipe recipe){
|
public PageCrusherRecipe(int id, CrusherRecipeRegistry.CrusherRecipe recipe){
|
||||||
super(id);
|
super(id);
|
||||||
this.recipe = recipe;
|
this.recipe = recipe;
|
||||||
InitBooklet.pagesWithItemStackData.add(this);
|
this.addToPagesWithItemStackData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
package ellpeck.actuallyadditions.booklet.page;
|
package ellpeck.actuallyadditions.booklet.page;
|
||||||
|
|
||||||
import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
||||||
import ellpeck.actuallyadditions.booklet.InitBooklet;
|
|
||||||
import ellpeck.actuallyadditions.proxy.ClientProxy;
|
import ellpeck.actuallyadditions.proxy.ClientProxy;
|
||||||
import ellpeck.actuallyadditions.util.ModUtil;
|
import ellpeck.actuallyadditions.util.ModUtil;
|
||||||
import ellpeck.actuallyadditions.util.StringUtil;
|
import ellpeck.actuallyadditions.util.StringUtil;
|
||||||
|
@ -35,7 +34,7 @@ public class PageFurnace extends BookletPage{
|
||||||
super(id);
|
super(id);
|
||||||
this.result = result;
|
this.result = result;
|
||||||
this.input = input;
|
this.input = input;
|
||||||
InitBooklet.pagesWithItemStackData.add(this);
|
this.addToPagesWithItemStackData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
package ellpeck.actuallyadditions.booklet.page;
|
package ellpeck.actuallyadditions.booklet.page;
|
||||||
|
|
||||||
import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
import ellpeck.actuallyadditions.booklet.GuiBooklet;
|
||||||
import ellpeck.actuallyadditions.booklet.InitBooklet;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class PageTextOnly extends BookletPage{
|
public class PageTextOnly extends BookletPage{
|
||||||
|
@ -23,10 +22,8 @@ public class PageTextOnly extends BookletPage{
|
||||||
}
|
}
|
||||||
|
|
||||||
public PageTextOnly setStack(ItemStack stack){
|
public PageTextOnly setStack(ItemStack stack){
|
||||||
if(!InitBooklet.pagesWithItemStackData.contains(this)){
|
|
||||||
InitBooklet.pagesWithItemStackData.add(this);
|
|
||||||
}
|
|
||||||
this.stack = stack;
|
this.stack = stack;
|
||||||
|
this.addToPagesWithItemStackData();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue