diff --git a/build.gradle b/build.gradle index ad55a994f..2af857636 100644 --- a/build.gradle +++ b/build.gradle @@ -52,10 +52,10 @@ processResources{ from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' - + expand 'version':project.version, 'mcversion':project.minecraft.version } - + from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' } diff --git a/src/main/java/cofh/api/energy/EnergyStorage.java b/src/main/java/cofh/api/energy/EnergyStorage.java index 1674c1894..25e0126ab 100644 --- a/src/main/java/cofh/api/energy/EnergyStorage.java +++ b/src/main/java/cofh/api/energy/EnergyStorage.java @@ -4,9 +4,9 @@ import net.minecraft.nbt.NBTTagCompound; /** * Reference implementation of {@link IEnergyStorage}. Use/extend this or implement your own. - * + * * @author King Lemming - * + * */ public class EnergyStorage implements IEnergyStorage { @@ -89,7 +89,7 @@ public class EnergyStorage implements IEnergyStorage { /** * This function is included to allow for server -> client sync. Do not call this externally to the containing Tile Entity, as not all IEnergyHandlers * are guaranteed to have it. - * + * * @param energy */ public void setEnergyStored(int energy) { @@ -106,7 +106,7 @@ public class EnergyStorage implements IEnergyStorage { /** * This function is included to allow the containing tile to directly and efficiently modify the energy contained in the EnergyStorage. Do not rely on this * externally, as not all IEnergyHandlers are guaranteed to have it. - * + * * @param energy */ public void modifyEnergyStored(int energy) { diff --git a/src/main/java/cofh/api/energy/IEnergyConnection.java b/src/main/java/cofh/api/energy/IEnergyConnection.java index 79bdf77af..301271e5a 100644 --- a/src/main/java/cofh/api/energy/IEnergyConnection.java +++ b/src/main/java/cofh/api/energy/IEnergyConnection.java @@ -7,9 +7,9 @@ import net.minecraftforge.common.util.ForgeDirection; * accept it; otherwise just use IEnergyHandler. *

* Note that {@link IEnergyHandler} is an extension of this. - * + * * @author King Lemming - * + * */ public interface IEnergyConnection { diff --git a/src/main/java/cofh/api/energy/IEnergyContainerItem.java b/src/main/java/cofh/api/energy/IEnergyContainerItem.java index c28455b1a..3ef725765 100644 --- a/src/main/java/cofh/api/energy/IEnergyContainerItem.java +++ b/src/main/java/cofh/api/energy/IEnergyContainerItem.java @@ -6,15 +6,15 @@ import net.minecraft.item.ItemStack; * Implement this interface on Item classes that support external manipulation of their internal energy storages. *

* A reference implementation is provided {@link ItemEnergyContainer}. - * + * * @author King Lemming - * + * */ public interface IEnergyContainerItem { /** * Adds energy to a container item. Returns the quantity of energy that was accepted. This should always return 0 if the item cannot be externally charged. - * + * * @param container * ItemStack to be charged. * @param maxReceive @@ -28,7 +28,7 @@ public interface IEnergyContainerItem { /** * Removes energy from a container item. Returns the quantity of energy that was removed. This should always return 0 if the item cannot be externally * discharged. - * + * * @param container * ItemStack to be discharged. * @param maxExtract diff --git a/src/main/java/cofh/api/energy/IEnergyStorage.java b/src/main/java/cofh/api/energy/IEnergyStorage.java index bc2065607..414b26566 100644 --- a/src/main/java/cofh/api/energy/IEnergyStorage.java +++ b/src/main/java/cofh/api/energy/IEnergyStorage.java @@ -5,15 +5,15 @@ package cofh.api.energy; * This is not to be implemented on TileEntities. This is for internal use only. *

* A reference implementation can be found at {@link EnergyStorage}. - * + * * @author King Lemming - * + * */ public interface IEnergyStorage { /** * Adds energy to the storage. Returns quantity of energy that was accepted. - * + * * @param maxReceive * Maximum amount of energy to be inserted. * @param simulate @@ -24,7 +24,7 @@ public interface IEnergyStorage { /** * Removes energy from the storage. Returns quantity of energy that was removed. - * + * * @param maxExtract * Maximum amount of energy to be extracted. * @param simulate diff --git a/src/main/java/cofh/api/energy/ItemEnergyContainer.java b/src/main/java/cofh/api/energy/ItemEnergyContainer.java index 055ae45bc..2d3659cb6 100644 --- a/src/main/java/cofh/api/energy/ItemEnergyContainer.java +++ b/src/main/java/cofh/api/energy/ItemEnergyContainer.java @@ -6,9 +6,9 @@ import net.minecraft.nbt.NBTTagCompound; /** * Reference implementation of {@link IEnergyContainerItem}. Use/extend this or implement your own. - * + * * @author King Lemming - * + * */ public class ItemEnergyContainer extends Item implements IEnergyContainerItem { diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java b/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java index 96fd9e268..637bce438 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/GuiBooklet.java @@ -401,6 +401,28 @@ public class GuiBooklet extends GuiScreen{ return false; } + private BookletPage getNextPage(BookletChapter chapter, BookletPage currentPage){ + for(int i = 0; i < chapter.pages.length; i++){ + if(chapter.pages[i] == currentPage){ + if(i+1 < chapter.pages.length){ + return chapter.pages[i+1]; + } + } + } + return null; + } + + private BookletPage getPrevPage(BookletChapter chapter, BookletPage currentPage){ + for(int i = 0; i < chapter.pages.length; i++){ + if(chapter.pages[i] == currentPage){ + if(i-1 >= 0){ + return chapter.pages[i-1]; + } + } + } + return null; + } + public void openChapter(BookletChapter chapter, BookletPage page){ if(chapter == null){ return; @@ -432,28 +454,6 @@ public class GuiBooklet extends GuiScreen{ return false; } - private BookletPage getNextPage(BookletChapter chapter, BookletPage currentPage){ - for(int i = 0; i < chapter.pages.length; i++){ - if(chapter.pages[i] == currentPage){ - if(i+1 < chapter.pages.length){ - return chapter.pages[i+1]; - } - } - } - return null; - } - - private BookletPage getPrevPage(BookletChapter chapter, BookletPage currentPage){ - for(int i = 0; i < chapter.pages.length; i++){ - if(chapter.pages[i] == currentPage){ - if(i-1 >= 0){ - return chapter.pages[i-1]; - } - } - } - return null; - } - @SuppressWarnings("unchecked") public void openIndexEntry(BookletIndexEntry entry, int page, boolean resetTextField){ if(resetTextField){ diff --git a/src/main/java/ellpeck/actuallyadditions/booklet/page/PageCrusherRecipe.java b/src/main/java/ellpeck/actuallyadditions/booklet/page/PageCrusherRecipe.java index 140ddf379..492e89384 100644 --- a/src/main/java/ellpeck/actuallyadditions/booklet/page/PageCrusherRecipe.java +++ b/src/main/java/ellpeck/actuallyadditions/booklet/page/PageCrusherRecipe.java @@ -42,26 +42,6 @@ public class PageCrusherRecipe extends BookletPage{ } } - @Override - public void updateScreen(int ticksElapsed){ - if(ticksElapsed%5 == 0){ - if(this.inputPos+1 < this.recipe.getRecipeInputs().size()){ - this.inputPos++; - } - else if(this.outOnePos+1 < this.recipe.getRecipeOutputOnes().size()){ - this.outOnePos++; - } - else if(this.outTwoPos+1 < this.recipe.getRecipeOutputTwos().size()){ - this.outTwoPos++; - } - else{ - this.inputPos = 0; - this.outOnePos = 0; - this.outTwoPos = 0; - } - } - } - @SuppressWarnings("unchecked") @Override public void render(GuiBooklet gui, int mouseX, int mouseY, boolean mouseClick, int ticksElapsed){ @@ -121,6 +101,26 @@ public class PageCrusherRecipe extends BookletPage{ } } + @Override + public void updateScreen(int ticksElapsed){ + if(ticksElapsed%5 == 0){ + if(this.inputPos+1 < this.recipe.getRecipeInputs().size()){ + this.inputPos++; + } + else if(this.outOnePos+1 < this.recipe.getRecipeOutputOnes().size()){ + this.outOnePos++; + } + else if(this.outTwoPos+1 < this.recipe.getRecipeOutputTwos().size()){ + this.outTwoPos++; + } + else{ + this.inputPos = 0; + this.outOnePos = 0; + this.outTwoPos = 0; + } + } + } + @Override public ItemStack[] getItemStacksForPage(){ return this.recipe == null ? new ItemStack[0] : this.recipe.getRecipeOutputOnes().toArray(new ItemStack[this.recipe.getRecipeOutputOnes().size()]); diff --git a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAllToolAA.java b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAllToolAA.java index bc5d1d3a3..05fe224f8 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAllToolAA.java +++ b/src/main/java/ellpeck/actuallyadditions/items/tools/ItemAllToolAA.java @@ -105,6 +105,18 @@ public class ItemAllToolAA extends ItemTool implements IActAddItemOrBlock{ return this.hasExtraWhitelist(block) || block.getMaterial().isToolNotRequired() || (block == Blocks.snow_layer || block == Blocks.snow || (block == Blocks.obsidian ? this.toolMaterial.getHarvestLevel() == 3 : (block != Blocks.diamond_block && block != Blocks.diamond_ore ? (block != Blocks.emerald_ore && block != Blocks.emerald_block ? (block != Blocks.gold_block && block != Blocks.gold_ore ? (block != Blocks.iron_block && block != Blocks.iron_ore ? (block != Blocks.lapis_block && block != Blocks.lapis_ore ? (block != Blocks.redstone_ore && block != Blocks.lit_redstone_ore ? (block.getMaterial() == Material.rock || (block.getMaterial() == Material.iron || block.getMaterial() == Material.anvil)) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2))); } + private boolean hasExtraWhitelist(Block block){ + String name = Block.blockRegistry.getNameForObject(block); + if(name != null){ + for(String list : ConfigValues.paxelExtraMiningWhitelist){ + if(list.equals(name)){ + return true; + } + } + } + return false; + } + @Override public String getName(){ return name; @@ -134,16 +146,4 @@ public class ItemAllToolAA extends ItemTool implements IActAddItemOrBlock{ public float getDigSpeed(ItemStack stack, Block block, int meta){ return this.hasExtraWhitelist(block) || block.getHarvestTool(meta) == null || block.getHarvestTool(meta).isEmpty() || this.getToolClasses(stack).contains(block.getHarvestTool(meta)) ? this.efficiencyOnProperMaterial : 1.0F; } - - private boolean hasExtraWhitelist(Block block){ - String name = Block.blockRegistry.getNameForObject(block); - if(name != null){ - for(String list : ConfigValues.paxelExtraMiningWhitelist){ - if(list.equals(name)){ - return true; - } - } - } - return false; - } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/nei/CrusherRecipeHandler.java b/src/main/java/ellpeck/actuallyadditions/nei/CrusherRecipeHandler.java index 18aa45113..3bb29fde4 100644 --- a/src/main/java/ellpeck/actuallyadditions/nei/CrusherRecipeHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/nei/CrusherRecipeHandler.java @@ -142,13 +142,19 @@ public class CrusherRecipeHandler extends TemplateRecipeHandler implements INeiR } @Override - public Class getGuiClass(){ - return GuiGrinder.GuiGrinderDouble.class; + public String getGuiTexture(){ + return ModUtil.MOD_ID_LOWER+":textures/gui/guiGrinderDouble.png"; } @Override - public String getGuiTexture(){ - return ModUtil.MOD_ID_LOWER+":textures/gui/guiGrinderDouble.png"; + public void drawExtras(int recipe){ + drawProgressBar(51, 40, 176, 0, 24, 23, 48, 1); + this.drawChanceString(66, 93, recipe); + } + + @Override + public Class getGuiClass(){ + return GuiGrinder.GuiGrinderDouble.class; } @Override @@ -157,12 +163,6 @@ public class CrusherRecipeHandler extends TemplateRecipeHandler implements INeiR GuiDraw.changeTexture(getGuiTexture()); GuiDraw.drawTexturedModalRect(33, 20, 33, 20, 110, 70); } - - @Override - public void drawExtras(int recipe){ - drawProgressBar(51, 40, 176, 0, 24, 23, 48, 1); - this.drawChanceString(66, 93, recipe); - } } public class CachedCrush extends CachedRecipe{ diff --git a/src/main/java/ellpeck/actuallyadditions/recipe/CrusherRecipeRegistry.java b/src/main/java/ellpeck/actuallyadditions/recipe/CrusherRecipeRegistry.java index 54e62245f..4756af6b8 100644 --- a/src/main/java/ellpeck/actuallyadditions/recipe/CrusherRecipeRegistry.java +++ b/src/main/java/ellpeck/actuallyadditions/recipe/CrusherRecipeRegistry.java @@ -28,10 +28,6 @@ public class CrusherRecipeRegistry{ recipes.add(new CrusherRecipe(input, outputOne, outputOneAmount, outputTwo, outputTwoAmount, outputTwoChance)); } - public static void addRecipe(String input, String outputOne, int outputOneAmount){ - recipes.add(new CrusherRecipe(input, outputOne, outputOneAmount, "", 0, 0)); - } - public static void registerFinally(){ ArrayList oresNoResult = new ArrayList(); int recipesAdded = 0; @@ -88,6 +84,15 @@ public class CrusherRecipeRegistry{ return false; } + public static void addRecipe(String input, String outputOne, int outputOneAmount){ + recipes.add(new CrusherRecipe(input, outputOne, outputOneAmount, "", 0, 0)); + } + + public static ArrayList getOutputOnes(ItemStack input){ + CrusherRecipe recipe = getRecipeFromInput(input); + return recipe == null ? null : recipe.getRecipeOutputOnes(); + } + public static CrusherRecipe getRecipeFromInput(ItemStack input){ for(CrusherRecipe recipe : recipes){ if(ItemUtil.contains(recipe.getRecipeInputs(), input, true)){ @@ -97,11 +102,6 @@ public class CrusherRecipeRegistry{ return null; } - public static ArrayList getOutputOnes(ItemStack input){ - CrusherRecipe recipe = getRecipeFromInput(input); - return recipe == null ? null : recipe.getRecipeOutputOnes(); - } - public static ArrayList getOutputTwos(ItemStack input){ CrusherRecipe recipe = getRecipeFromInput(input); return recipe == null ? null : recipe.getRecipeOutputTwos(); @@ -133,7 +133,9 @@ public class CrusherRecipeRegistry{ } public ArrayList getRecipeOutputOnes(){ - if(this.outputOne == null || this.outputOne.isEmpty()) return null; + if(this.outputOne == null || this.outputOne.isEmpty()){ + return null; + } ArrayList stacks = OreDictionary.getOres(this.outputOne); for(ItemStack stack : stacks){ @@ -143,7 +145,9 @@ public class CrusherRecipeRegistry{ } public ArrayList getRecipeOutputTwos(){ - if(this.outputTwo == null || this.outputTwo.isEmpty()) return null; + if(this.outputTwo == null || this.outputTwo.isEmpty()){ + return null; + } ArrayList stacks = OreDictionary.getOres(this.outputTwo); for(ItemStack stack : stacks){ @@ -153,7 +157,9 @@ public class CrusherRecipeRegistry{ } public ArrayList getRecipeInputs(){ - if(this.input == null || this.input.isEmpty()) return null; + if(this.input == null || this.input.isEmpty()){ + return null; + } ArrayList stacks = OreDictionary.getOres(this.input); for(ItemStack stack : stacks){ @@ -169,15 +175,15 @@ public class CrusherRecipeRegistry{ int resultAmount; String resultPreString; + public SearchCase(String theCase, int resultAmount){ + this(theCase, resultAmount, "dust"); + } + public SearchCase(String theCase, int resultAmount, String resultPreString){ this.theCase = theCase; this.resultAmount = resultAmount; this.resultPreString = resultPreString; } - - public SearchCase(String theCase, int resultAmount){ - this(theCase, resultAmount, "dust"); - } } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBreaker.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBreaker.java index b6189353e..e8bc43841 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBreaker.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBreaker.java @@ -76,18 +76,18 @@ public class TileEntityBreaker extends TileEntityInventoryBase{ } } - @Override - public void writeToNBT(NBTTagCompound compound){ - super.writeToNBT(compound); - compound.setInteger("CurrentTime", this.currentTime); - } - @Override public void readFromNBT(NBTTagCompound compound){ super.readFromNBT(compound); this.currentTime = compound.getInteger("CurrentTime"); } + @Override + public void writeToNBT(NBTTagCompound compound){ + super.writeToNBT(compound); + compound.setInteger("CurrentTime", this.currentTime); + } + @Override public boolean isItemValidForSlot(int i, ItemStack stack){ return this.isPlacer; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCanolaPress.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCanolaPress.java index 97b8d5c4a..0ce28e87a 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCanolaPress.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCanolaPress.java @@ -105,14 +105,6 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE return this.storage.getEnergyStored()*i/this.storage.getMaxEnergyStored(); } - @Override - public void writeToNBT(NBTTagCompound compound){ - compound.setInteger("ProcessTime", this.currentProcessTime); - this.storage.writeToNBT(compound); - this.tank.writeToNBT(compound); - super.writeToNBT(compound); - } - @Override public void readFromNBT(NBTTagCompound compound){ this.currentProcessTime = compound.getInteger("ProcessTime"); @@ -121,6 +113,14 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE super.readFromNBT(compound); } + @Override + public void writeToNBT(NBTTagCompound compound){ + compound.setInteger("ProcessTime", this.currentProcessTime); + this.storage.writeToNBT(compound); + this.tank.writeToNBT(compound); + super.writeToNBT(compound); + } + @Override public boolean isItemValidForSlot(int i, ItemStack stack){ return (i == 0 && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CANOLA.ordinal()) || (i == 1 && stack.getItem() == Items.bucket); diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoalGenerator.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoalGenerator.java index 595861283..19dbd8c1a 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoalGenerator.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoalGenerator.java @@ -100,14 +100,6 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements return this.currentBurnTime*i/this.maxBurnTime; } - @Override - public void writeToNBT(NBTTagCompound compound){ - compound.setInteger("BurnTime", this.currentBurnTime); - compound.setInteger("MaxBurnTime", this.maxBurnTime); - this.storage.writeToNBT(compound); - super.writeToNBT(compound); - } - @Override public void readFromNBT(NBTTagCompound compound){ this.currentBurnTime = compound.getInteger("BurnTime"); @@ -116,6 +108,14 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements super.readFromNBT(compound); } + @Override + public void writeToNBT(NBTTagCompound compound){ + compound.setInteger("BurnTime", this.currentBurnTime); + compound.setInteger("MaxBurnTime", this.maxBurnTime); + this.storage.writeToNBT(compound); + super.writeToNBT(compound); + } + @Override public boolean isItemValidForSlot(int i, ItemStack stack){ return TileEntityFurnace.getItemBurnTime(stack) > 0; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoffeeMachine.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoffeeMachine.java index 07f98e55e..0a66cb040 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoffeeMachine.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCoffeeMachine.java @@ -141,15 +141,6 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements return this.brewTime*i/ConfigIntValues.COFFEE_MACHINE_TIME_USED.getValue(); } - @Override - public void writeToNBT(NBTTagCompound compound){ - super.writeToNBT(compound); - this.storage.writeToNBT(compound); - this.tank.writeToNBT(compound); - compound.setInteger("Cache", this.coffeeCacheAmount); - compound.setInteger("Time", this.brewTime); - } - @Override public void readFromNBT(NBTTagCompound compound){ super.readFromNBT(compound); @@ -159,6 +150,15 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements this.brewTime = compound.getInteger("Time"); } + @Override + public void writeToNBT(NBTTagCompound compound){ + super.writeToNBT(compound); + this.storage.writeToNBT(compound); + this.tank.writeToNBT(compound); + compound.setInteger("Cache", this.coffeeCacheAmount); + compound.setInteger("Time", this.brewTime); + } + @Override public boolean isItemValidForSlot(int i, ItemStack stack){ return (i >= 3 && ItemCoffee.getIngredientFromStack(stack) != null) || (i == SLOT_COFFEE_BEANS && stack.getItem() == InitItems.itemCoffeeBean) || (i == SLOT_INPUT && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CUP.ordinal()); diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCompost.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCompost.java index 4a71f311c..40938be36 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCompost.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityCompost.java @@ -56,18 +56,18 @@ public class TileEntityCompost extends TileEntityInventoryBase{ } } - @Override - public void writeToNBT(NBTTagCompound compound){ - super.writeToNBT(compound); - compound.setInteger("ConversionTime", this.conversionTime); - } - @Override public void readFromNBT(NBTTagCompound compound){ super.readFromNBT(compound); this.conversionTime = compound.getInteger("ConversionTime"); } + @Override + public void writeToNBT(NBTTagCompound compound){ + super.writeToNBT(compound); + compound.setInteger("ConversionTime", this.conversionTime); + } + @Override public int getInventoryStackLimit(){ return ConfigIntValues.COMPOST_AMOUNT.getValue(); diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityDropper.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityDropper.java index 314c28e2d..a5881c8f9 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityDropper.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityDropper.java @@ -62,18 +62,18 @@ public class TileEntityDropper extends TileEntityInventoryBase{ return null; } - @Override - public void writeToNBT(NBTTagCompound compound){ - super.writeToNBT(compound); - compound.setInteger("CurrentTime", this.currentTime); - } - @Override public void readFromNBT(NBTTagCompound compound){ super.readFromNBT(compound); this.currentTime = compound.getInteger("CurrentTime"); } + @Override + public void writeToNBT(NBTTagCompound compound){ + super.writeToNBT(compound); + compound.setInteger("CurrentTime", this.currentTime); + } + @Override public boolean isItemValidForSlot(int i, ItemStack stack){ return true; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnergizer.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnergizer.java index d9986a675..c88118a70 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnergizer.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnergizer.java @@ -55,18 +55,18 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements IEne } } - @Override - public void writeToNBT(NBTTagCompound compound){ - this.storage.writeToNBT(compound); - super.writeToNBT(compound); - } - @Override public void readFromNBT(NBTTagCompound compound){ this.storage.readFromNBT(compound); super.readFromNBT(compound); } + @Override + public void writeToNBT(NBTTagCompound compound){ + this.storage.writeToNBT(compound); + super.writeToNBT(compound); + } + @Override public boolean isItemValidForSlot(int i, ItemStack stack){ return i == 0 && stack.getItem() instanceof IEnergyContainerItem; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnervator.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnervator.java index 8bfcc550b..eacb8d48f 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnervator.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityEnervator.java @@ -65,18 +65,18 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements IEne } } - @Override - public void writeToNBT(NBTTagCompound compound){ - this.storage.writeToNBT(compound); - super.writeToNBT(compound); - } - @Override public void readFromNBT(NBTTagCompound compound){ this.storage.readFromNBT(compound); super.readFromNBT(compound); } + @Override + public void writeToNBT(NBTTagCompound compound){ + this.storage.writeToNBT(compound); + super.writeToNBT(compound); + } + @Override public boolean isItemValidForSlot(int i, ItemStack stack){ return i == 0 && stack.getItem() instanceof IEnergyContainerItem; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFeeder.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFeeder.java index 507efabc7..ed5a63596 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFeeder.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFeeder.java @@ -100,18 +100,18 @@ public class TileEntityFeeder extends TileEntityInventoryBase implements IPacket return this.currentTimer*i/ConfigIntValues.FEEDER_TIME.getValue(); } - @Override - public void writeToNBT(NBTTagCompound compound){ - super.writeToNBT(compound); - compound.setInteger("Timer", this.currentTimer); - } - @Override public void readFromNBT(NBTTagCompound compound){ super.readFromNBT(compound); this.currentTimer = compound.getInteger("Timer"); } + @Override + public void writeToNBT(NBTTagCompound compound){ + super.writeToNBT(compound); + compound.setInteger("Timer", this.currentTimer); + } + @Override public boolean isItemValidForSlot(int i, ItemStack stack){ return true; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceDouble.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceDouble.java index 97c20ad95..e6b29dbc9 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceDouble.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFurnaceDouble.java @@ -131,14 +131,6 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements } } - @Override - public void writeToNBT(NBTTagCompound compound){ - super.writeToNBT(compound); - compound.setInteger("FirstSmeltTime", this.firstSmeltTime); - compound.setInteger("SecondSmeltTime", this.secondSmeltTime); - this.storage.writeToNBT(compound); - } - @Override public void readFromNBT(NBTTagCompound compound){ super.readFromNBT(compound); @@ -147,6 +139,14 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements this.storage.readFromNBT(compound); } + @Override + public void writeToNBT(NBTTagCompound compound){ + super.writeToNBT(compound); + compound.setInteger("FirstSmeltTime", this.firstSmeltTime); + compound.setInteger("SecondSmeltTime", this.secondSmeltTime); + this.storage.writeToNBT(compound); + } + @Override public boolean isItemValidForSlot(int i, ItemStack stack){ return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && FurnaceRecipes.smelting().getSmeltingResult(stack) != null; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java index 65eedca03..59d37ebcd 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java @@ -215,14 +215,6 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg } } - @Override - public void writeToNBT(NBTTagCompound compound){ - compound.setInteger("FirstCrushTime", this.firstCrushTime); - compound.setInteger("SecondCrushTime", this.secondCrushTime); - this.storage.writeToNBT(compound); - super.writeToNBT(compound); - } - @Override public void readFromNBT(NBTTagCompound compound){ this.firstCrushTime = compound.getInteger("FirstCrushTime"); @@ -231,6 +223,14 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg super.readFromNBT(compound); } + @Override + public void writeToNBT(NBTTagCompound compound){ + compound.setInteger("FirstCrushTime", this.firstCrushTime); + compound.setInteger("SecondCrushTime", this.secondCrushTime); + this.storage.writeToNBT(compound); + super.writeToNBT(compound); + } + @Override public boolean isItemValidForSlot(int i, ItemStack stack){ return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && CrusherRecipeRegistry.getRecipeFromInput(stack) != null; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java index c7bfb6c93..f01537669 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java @@ -424,19 +424,6 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt this.markDirty(); } - @Override - public void writeToNBT(NBTTagCompound compound){ - super.writeToNBT(compound); - compound.setInteger("SideToPut", this.sideToPut); - compound.setInteger("SlotToPut", this.slotToPutStart); - compound.setInteger("SlotToPutEnd", this.slotToPutEnd); - compound.setInteger("SideToPull", this.sideToPull); - compound.setInteger("SlotToPull", this.slotToPullStart); - compound.setInteger("SlotToPullEnd", this.slotToPullEnd); - compound.setBoolean("PullWhitelist", this.isPullWhitelist); - compound.setBoolean("PutWhitelist", this.isPutWhitelist); - } - @Override public void readFromNBT(NBTTagCompound compound){ this.sideToPut = compound.getInteger("SideToPut"); @@ -450,6 +437,19 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt super.readFromNBT(compound); } + @Override + public void writeToNBT(NBTTagCompound compound){ + super.writeToNBT(compound); + compound.setInteger("SideToPut", this.sideToPut); + compound.setInteger("SlotToPut", this.slotToPutStart); + compound.setInteger("SlotToPutEnd", this.slotToPutEnd); + compound.setInteger("SideToPull", this.sideToPull); + compound.setInteger("SlotToPull", this.slotToPullStart); + compound.setInteger("SlotToPullEnd", this.slotToPullEnd); + compound.setBoolean("PullWhitelist", this.isPullWhitelist); + compound.setBoolean("PutWhitelist", this.isPutWhitelist); + } + @Override public boolean isItemValidForSlot(int i, ItemStack stack){ return i == 0; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInventoryBase.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInventoryBase.java index 2deb47bfb..c583ebdbc 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInventoryBase.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInventoryBase.java @@ -61,9 +61,6 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements } compound.setTag("Items", tagList); } - } @Override - public int getInventoryStackLimit(){ - return 64; } @Override @@ -79,6 +76,13 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements return new int[0]; } } @Override + public int getInventoryStackLimit(){ + return 64; + } + + + + @Override public boolean isUseableByPlayer(EntityPlayer player){ return player.getDistanceSq(xCoord+0.5D, yCoord+0.5D, zCoord+0.5D) <= 64; } @@ -135,7 +139,6 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements } - @Override public String getInventoryName(){ return this.name; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityItemRepairer.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityItemRepairer.java index 596697fa6..4b8a34d6b 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityItemRepairer.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityItemRepairer.java @@ -70,13 +70,6 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I return stack != null && stack.getItem().isRepairable(); } - @Override - public void writeToNBT(NBTTagCompound compound){ - compound.setInteger("NextRepairTick", this.nextRepairTick); - super.writeToNBT(compound); - this.storage.writeToNBT(compound); - } - @Override public void readFromNBT(NBTTagCompound compound){ this.nextRepairTick = compound.getInteger("NextRepairTick"); @@ -84,6 +77,13 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I this.storage.readFromNBT(compound); } + @Override + public void writeToNBT(NBTTagCompound compound){ + compound.setInteger("NextRepairTick", this.nextRepairTick); + super.writeToNBT(compound); + this.storage.writeToNBT(compound); + } + @Override public boolean isItemValidForSlot(int i, ItemStack stack){ return i == SLOT_INPUT; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOilGenerator.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOilGenerator.java index 6486b122c..0ea01e1a2 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOilGenerator.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOilGenerator.java @@ -103,14 +103,6 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I return this.currentBurnTime*i/ConfigIntValues.OIL_GEN_BURN_TIME.getValue(); } - @Override - public void writeToNBT(NBTTagCompound compound){ - compound.setInteger("BurnTime", this.currentBurnTime); - this.storage.writeToNBT(compound); - this.tank.writeToNBT(compound); - super.writeToNBT(compound); - } - @Override public void readFromNBT(NBTTagCompound compound){ this.currentBurnTime = compound.getInteger("BurnTime"); @@ -119,6 +111,14 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I super.readFromNBT(compound); } + @Override + public void writeToNBT(NBTTagCompound compound){ + compound.setInteger("BurnTime", this.currentBurnTime); + this.storage.writeToNBT(compound); + this.tank.writeToNBT(compound); + super.writeToNBT(compound); + } + @Override public boolean isItemValidForSlot(int i, ItemStack stack){ return FluidContainerRegistry.containsFluid(stack, new FluidStack(InitBlocks.fluidOil, FluidContainerRegistry.BUCKET_VOLUME)) && i == 0; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOreMagnet.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOreMagnet.java index c251f2106..87b0f02ea 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOreMagnet.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityOreMagnet.java @@ -181,14 +181,6 @@ public class TileEntityOreMagnet extends TileEntityInventoryBase implements IEne return this.tank.getFluidAmount()*i/this.tank.getCapacity(); } - @Override - public void writeToNBT(NBTTagCompound compound){ - this.storage.writeToNBT(compound); - this.tank.writeToNBT(compound); - compound.setInteger("CurrentWorkTimer", this.currentWorkTimer); - super.writeToNBT(compound); - } - @Override public void readFromNBT(NBTTagCompound compound){ this.storage.readFromNBT(compound); @@ -197,6 +189,14 @@ public class TileEntityOreMagnet extends TileEntityInventoryBase implements IEne super.readFromNBT(compound); } + @Override + public void writeToNBT(NBTTagCompound compound){ + this.storage.writeToNBT(compound); + this.tank.writeToNBT(compound); + compound.setInteger("CurrentWorkTimer", this.currentWorkTimer); + super.writeToNBT(compound); + } + @Override public boolean isItemValidForSlot(int i, ItemStack stack){ return FluidContainerRegistry.containsFluid(stack, new FluidStack(InitBlocks.fluidOil, 1)) && i == SLOT_OIL_INPUT; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomface.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomface.java index 57165a154..2b040cb15 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomface.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityPhantomface.java @@ -130,17 +130,6 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP return this.range; } - @Override - public void writeToNBT(NBTTagCompound compound){ - super.writeToNBT(compound); - if(this.hasBoundPosition()){ - compound.setInteger("XCoordOfTileStored", boundPosition.getX()); - compound.setInteger("YCoordOfTileStored", boundPosition.getY()); - compound.setInteger("ZCoordOfTileStored", boundPosition.getZ()); - compound.setInteger("WorldOfTileStored", boundPosition.getWorld().provider.dimensionId); - } - } - @Override public void readFromNBT(NBTTagCompound compound){ super.readFromNBT(compound); @@ -154,6 +143,17 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP } } + @Override + public void writeToNBT(NBTTagCompound compound){ + super.writeToNBT(compound); + if(this.hasBoundPosition()){ + compound.setInteger("XCoordOfTileStored", boundPosition.getX()); + compound.setInteger("YCoordOfTileStored", boundPosition.getY()); + compound.setInteger("ZCoordOfTileStored", boundPosition.getZ()); + compound.setInteger("WorldOfTileStored", boundPosition.getWorld().provider.dimensionId); + } + } + @Override public boolean canInsertItem(int slot, ItemStack stack, int side){ return false; @@ -214,9 +214,6 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP } } } - } @Override - public boolean isBoundThingInRange(){ - return super.isBoundThingInRange() && this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IFluidHandler; } @Override @@ -225,6 +222,9 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP return this.getHandler().fill(from, resource, doFill); } return 0; + } @Override + public boolean isBoundThingInRange(){ + return super.isBoundThingInRange() && this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IFluidHandler; } @Override @@ -262,6 +262,8 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP } + + } public static class TileEntityPhantomEnergyface extends TileEntityPhantomface implements IEnergyHandler{ @@ -274,14 +276,40 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP @Override public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate){ return this.isBoundThingInRange() && this.getReceiver() != null ? this.getReceiver().receiveEnergy(from, maxReceive, simulate) : 0; + } + + @Override + public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate){ + return this.isBoundThingInRange() && this.getProvider() != null ? this.getProvider().extractEnergy(from, maxExtract, simulate) : 0; } @Override public boolean isBoundThingInRange(){ return super.isBoundThingInRange() && (this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IEnergyReceiver || this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IEnergyProvider); } @Override - public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate){ - return this.isBoundThingInRange() && this.getProvider() != null ? this.getProvider().extractEnergy(from, maxExtract, simulate) : 0; + public int getEnergyStored(ForgeDirection from){ + if(this.isBoundThingInRange()){ + if(this.getProvider() != null){ + return this.getProvider().getEnergyStored(from); + } + if(this.getReceiver() != null){ + return this.getReceiver().getEnergyStored(from); + } + } + return 0; + } + + @Override + public int getMaxEnergyStored(ForgeDirection from){ + if(this.isBoundThingInRange()){ + if(this.getProvider() != null){ + return this.getProvider().getMaxEnergyStored(from); + } + if(this.getReceiver() != null){ + return this.getReceiver().getMaxEnergyStored(from); + } + } + return 0; } @Override public void updateEntity(){ super.updateEntity(); @@ -298,49 +326,6 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP } } - @Override - public int getEnergyStored(ForgeDirection from){ - if(this.isBoundThingInRange()){ - if(this.getProvider() != null){ - return this.getProvider().getEnergyStored(from); - } - if(this.getReceiver() != null){ - return this.getReceiver().getEnergyStored(from); - } - } - return 0; - } private void pushEnergy(ForgeDirection side){ - TileEntity tile = WorldUtil.getTileEntityFromSide(side, worldObj, xCoord, yCoord, zCoord); - if(tile != null && tile instanceof IEnergyReceiver && this.getProvider().getEnergyStored(ForgeDirection.UNKNOWN) > 0){ - if(((IEnergyReceiver)tile).canConnectEnergy(side.getOpposite()) && this.canConnectEnergy(side)){ - int receive = this.extractEnergy(side, Math.min(((IEnergyReceiver)tile).getMaxEnergyStored(ForgeDirection.UNKNOWN)-((IEnergyReceiver)tile).getEnergyStored(ForgeDirection.UNKNOWN), this.getEnergyStored(ForgeDirection.UNKNOWN)), true); - int actualReceive = ((IEnergyReceiver)tile).receiveEnergy(side.getOpposite(), receive, false); - this.extractEnergy(side, actualReceive, false); - } - } - } - - @Override - public int getMaxEnergyStored(ForgeDirection from){ - if(this.isBoundThingInRange()){ - if(this.getProvider() != null){ - return this.getProvider().getMaxEnergyStored(from); - } - if(this.getReceiver() != null){ - return this.getReceiver().getMaxEnergyStored(from); - } - } - return 0; - } public IEnergyProvider getProvider(){ - if(this.boundPosition != null && this.boundPosition.getWorld() != null){ - TileEntity tile = boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()); - if(tile instanceof IEnergyProvider){ - return (IEnergyProvider)tile; - } - } - return null; - } - public IEnergyReceiver getReceiver(){ if(this.boundPosition != null && this.boundPosition.getWorld() != null){ TileEntity tile = boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()); @@ -351,10 +336,28 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP return null; } + private void pushEnergy(ForgeDirection side){ + TileEntity tile = WorldUtil.getTileEntityFromSide(side, worldObj, xCoord, yCoord, zCoord); + if(tile != null && tile instanceof IEnergyReceiver && this.getProvider().getEnergyStored(ForgeDirection.UNKNOWN) > 0){ + if(((IEnergyReceiver)tile).canConnectEnergy(side.getOpposite()) && this.canConnectEnergy(side)){ + int receive = this.extractEnergy(side, Math.min(((IEnergyReceiver)tile).getMaxEnergyStored(ForgeDirection.UNKNOWN)-((IEnergyReceiver)tile).getEnergyStored(ForgeDirection.UNKNOWN), this.getEnergyStored(ForgeDirection.UNKNOWN)), true); + int actualReceive = ((IEnergyReceiver)tile).receiveEnergy(side.getOpposite(), receive, false); + this.extractEnergy(side, actualReceive, false); + } + } + } - + public IEnergyProvider getProvider(){ + if(this.boundPosition != null && this.boundPosition.getWorld() != null){ + TileEntity tile = boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()); + if(tile instanceof IEnergyProvider){ + return (IEnergyProvider)tile; + } + } + return null; + } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityXPSolidifier.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityXPSolidifier.java index 745fb061d..392338b61 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityXPSolidifier.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityXPSolidifier.java @@ -55,18 +55,18 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I } } - @Override - public void writeToNBT(NBTTagCompound compound){ - super.writeToNBT(compound); - compound.setShort("Amount", this.amount); - } - @Override public void readFromNBT(NBTTagCompound compound){ super.readFromNBT(compound); this.amount = compound.getShort("Amount"); } + @Override + public void writeToNBT(NBTTagCompound compound){ + super.writeToNBT(compound); + compound.setShort("Amount", this.amount); + } + @Override public boolean isItemValidForSlot(int i, ItemStack stack){ return false; diff --git a/src/main/java/ellpeck/actuallyadditions/util/ItemUtil.java b/src/main/java/ellpeck/actuallyadditions/util/ItemUtil.java index cf985c454..0e97bcca5 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/ItemUtil.java +++ b/src/main/java/ellpeck/actuallyadditions/util/ItemUtil.java @@ -61,13 +61,6 @@ public class ItemUtil{ return true; } - /** - * Returns true if list contains stack or if both contain null - */ - public static boolean contains(List list, ItemStack stack, boolean checkWildcard){ - return !(list == null || list.isEmpty()) && getPlaceAt(list.toArray(new ItemStack[list.size()]), stack, checkWildcard) != -1; - } - /** * Returns true if array contains stack or if both contain null */ @@ -93,6 +86,13 @@ public class ItemUtil{ return stack1 != null && stack2 != null && (stack1.isItemEqual(stack2) || (checkWildcard && stack1.getItem() == stack2.getItem() && (stack1.getItemDamage() == Util.WILDCARD || stack2.getItemDamage() == Util.WILDCARD))); } + /** + * Returns true if list contains stack or if both contain null + */ + public static boolean contains(List list, ItemStack stack, boolean checkWildcard){ + return !(list == null || list.isEmpty()) && getPlaceAt(list.toArray(new ItemStack[list.size()]), stack, checkWildcard) != -1; + } + public static void addEnchantment(ItemStack stack, Enchantment e, int level){ if(!hasEnchantment(stack, e)){ stack.addEnchantment(e, level);