remov null

This commit is contained in:
Shadows_of_Fire 2017-11-02 17:49:53 -04:00
parent 636156d2ee
commit 856d62f78c
76 changed files with 299 additions and 348 deletions

View file

@ -122,7 +122,7 @@ public final class ActuallyAdditionsAPI{
*
* @param input The input as an ItemStack
* @param outputOne The first output as an ItemStack
* @param outputTwo The second output as an ItemStack (can be null if there should be none)
* @param outputTwo The second output as an ItemStack (can be ItemStack.EMPTY if there should be none)
* @param outputTwoChance The chance of the second output (0 won't occur at all, 100 will all the time)
*/
public static void addCrusherRecipe(ItemStack input, ItemStack outputOne, ItemStack outputTwo, int outputTwoChance){
@ -136,7 +136,7 @@ public final class ActuallyAdditionsAPI{
* @param inputs The inputs as an ItemStack List, stacksizes are ignored
* @param outputOnes The first outputs as an ItemStack List, stacksizes are ignored
* @param outputOneAmounts The amount of the first output, will be equal for all entries in the list
* @param outputTwos The second outputs as an ItemStack List (can be null or empty if there should be none)
* @param outputTwos The second outputs as an List<ItemStack> (can be null or empty if there should be none)
* @param outputTwoAmounts The amount of the second output, will be equal for all entries in the list
* @param outputTwoChance The chance of the second output (0 won't occur at all, 100 will all the time)
*/

View file

@ -35,6 +35,6 @@ public class CoffeeIngredient{
}
public String getExtraText(){
return null;
return "";
}
}

View file

@ -94,7 +94,7 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud
ItemStack slot = reconstructor.slots.getStackInSlot(0);
if(StackUtil.isValid(slot)){
player.setHeldItem(hand, slot.copy());
reconstructor.slots.setStackInSlot(0, StackUtil.getNull());
reconstructor.slots.setStackInSlot(0, StackUtil.getEmpty());
}
}
}

View file

@ -58,7 +58,7 @@ public class BlockBatteryBox extends BlockContainerBase{
if(StackUtil.isValid(stack)){
if(stack.getItem() instanceof ItemBattery && !StackUtil.isValid(box.slots.getStackInSlot(0))){
box.slots.setStackInSlot(0, stack.copy());
player.setHeldItem(hand, StackUtil.getNull());
player.setHeldItem(hand, StackUtil.getEmpty());
return true;
}
}
@ -66,7 +66,7 @@ public class BlockBatteryBox extends BlockContainerBase{
ItemStack inSlot = box.slots.getStackInSlot(0);
if(StackUtil.isValid(inSlot)){
player.setHeldItem(hand, inSlot.copy());
box.slots.setStackInSlot(0, StackUtil.getNull());
box.slots.setStackInSlot(0, StackUtil.getEmpty());
return true;
}
}

View file

@ -119,7 +119,7 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{
else{
if(!StackUtil.isValid(stackPlayer)){
player.setHeldItem(hand, slot.copy());
compost.slots.setStackInSlot(0, StackUtil.getNull());
compost.slots.setStackInSlot(0, StackUtil.getEmpty());
return true;
}
else if(ItemUtil.canBeStacked(stackPlayer, slot)){

View file

@ -79,7 +79,7 @@ public class BlockDisplayStand extends BlockContainerBase{
else{
if(StackUtil.isValid(display)){
player.setHeldItem(hand, display.copy());
stand.slots.setStackInSlot(0, StackUtil.getNull());
stand.slots.setStackInSlot(0, StackUtil.getEmpty());
return true;
}
}

View file

@ -78,7 +78,7 @@ public class BlockEmpowerer extends BlockContainerBase{
else{
if(StackUtil.isValid(stackThere)){
player.setHeldItem(hand, stackThere.copy());
empowerer.slots.setStackInSlot(0, StackUtil.getNull());
empowerer.slots.setStackInSlot(0, StackUtil.getEmpty());
return true;
}
}

View file

@ -206,7 +206,7 @@ public class BlockLaserRelay extends BlockContainerBase implements IHudDisplay{
ItemStack inRelay = StackUtil.validateCopy(relay.slots.getStackInSlot(0));
if(StackUtil.isValid(inRelay)){
if(!world.isRemote){
relay.slots.setStackInSlot(0, StackUtil.getNull());
relay.slots.setStackInSlot(0, StackUtil.getEmpty());
if(!player.inventory.addItemStackToInventory(inRelay)){
player.entityDropItem(inRelay, 0);

View file

@ -16,7 +16,6 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockStair;
import de.ellpeck.actuallyadditions.mod.blocks.metalists.TheMiscBlocks;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.compat.CompatUtil;
import net.minecraft.block.Block;
public final class InitBlocks{
@ -179,13 +178,9 @@ public final class InitBlocks{
blockOilGenerator = new BlockOilGenerator("block_oil_generator");
blockFermentingBarrel = new BlockFermentingBarrel("block_fermenting_barrel");
blockRice = new BlockPlant("block_rice", 1, 2);
CompatUtil.registerPlant(blockRice);
blockCanola = new BlockPlant("block_canola", 2, 3);
CompatUtil.registerPlant(blockCanola);
blockFlax = new BlockPlant("block_flax", 2, 4);
CompatUtil.registerPlant(blockFlax);
blockCoffee = new BlockPlant("block_coffee", 2, 2);
CompatUtil.registerPlant(blockCoffee);
blockCompost = new BlockCompost("block_compost");
blockMisc = new BlockMisc("block_misc");
blockFeeder = new BlockFeeder("block_feeder");

View file

@ -30,6 +30,7 @@ public class EntryButton extends GuiButton{
public EntryButton(GuiBookletBase gui, int id, int x, int y, int width, int height, String text, ItemStack stackToRender){
super(id, x, y, width, height, text);
this.gui = gui;
StackUtil.isValid(stackToRender);
this.stackToRender = stackToRender;
}
@ -44,7 +45,7 @@ public class EntryButton extends GuiButton{
this.mouseDragged(minecraft, mouseX, mouseY);
int textOffsetX = 0;
if(StackUtil.isValid(this.stackToRender == null ? ItemStack.EMPTY : this.stackToRender)){
if(StackUtil.isValid(this.stackToRender)){
GlStateManager.pushMatrix();
AssetUtil.renderStackToGui(this.stackToRender, this.x-4, this.y, 0.725F);
GlStateManager.popMatrix();

View file

@ -10,6 +10,8 @@
package de.ellpeck.actuallyadditions.mod.booklet.misc;
import java.util.List;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter;
import de.ellpeck.actuallyadditions.api.booklet.IBookletPage;
@ -20,17 +22,15 @@ import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiPage;
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.List;
public final class BookletUtils{
public static IBookletPage findFirstPageForStack(ItemStack stack){
for(IBookletPage page : ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_OR_FLUID_DATA){
List<ItemStack> stacks = new ArrayList<ItemStack>();
List<ItemStack> stacks = NonNullList.create();
page.getItemStacksForPage(stacks);
if(stacks != null && !stacks.isEmpty()){
for(ItemStack pageStack : stacks){

View file

@ -48,7 +48,7 @@ public class PageFurnace extends BookletPage{
}
}
}
return null;
return ItemStack.EMPTY;
}
@Override

View file

@ -37,58 +37,58 @@ public final class CrusherCrafting{
public static void init(){
ModUtil.LOGGER.info("Initializing Crusher Recipes...");
final NonNullList<ItemStack> LIST = NonNullList.withSize(1, StackUtil.getNull());
final NonNullList<ItemStack> LIST = NonNullList.withSize(1, StackUtil.getEmpty());
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.BONE), new ItemStack(Items.DYE, 6, 15), StackUtil.getNull(), 0);
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.BONE), new ItemStack(Items.DYE, 6, 15), StackUtil.getEmpty(), 0);
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.REEDS), new ItemStack(Items.SUGAR, 3), StackUtil.getNull(), 0);
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.REEDS), new ItemStack(Items.SUGAR, 3), StackUtil.getEmpty(), 0);
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.BLAZE_ROD), new ItemStack(Items.BLAZE_POWDER, 4), StackUtil.getNull(), 0);
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Items.BLAZE_ROD), new ItemStack(Items.BLAZE_POWDER, 4), StackUtil.getEmpty(), 0);
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.YELLOW_FLOWER), new ItemStack(Items.DYE, 3, 11), StackUtil.getNull(), 0);
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.YELLOW_FLOWER), new ItemStack(Items.DYE, 3, 11), StackUtil.getEmpty(), 0);
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 0), new ItemStack(Items.DYE, 3, 1), StackUtil.getNull(), 0);
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 0), new ItemStack(Items.DYE, 3, 1), StackUtil.getEmpty(), 0);
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 1), new ItemStack(Items.DYE, 3, 12), StackUtil.getNull(), 0);
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 1), new ItemStack(Items.DYE, 3, 12), StackUtil.getEmpty(), 0);
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 2), new ItemStack(Items.DYE, 3, 13), StackUtil.getNull(), 0);
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 2), new ItemStack(Items.DYE, 3, 13), StackUtil.getEmpty(), 0);
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 3), new ItemStack(Items.DYE, 3, 7), StackUtil.getNull(), 0);
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 3), new ItemStack(Items.DYE, 3, 7), StackUtil.getEmpty(), 0);
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 4), new ItemStack(Items.DYE, 3, 1), StackUtil.getNull(), 0);
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 4), new ItemStack(Items.DYE, 3, 1), StackUtil.getEmpty(), 0);
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 5), new ItemStack(Items.DYE, 3, 14), StackUtil.getNull(), 0);
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 5), new ItemStack(Items.DYE, 3, 14), StackUtil.getEmpty(), 0);
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 6), new ItemStack(Items.DYE, 3, 7), StackUtil.getNull(), 0);
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 6), new ItemStack(Items.DYE, 3, 7), StackUtil.getEmpty(), 0);
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 7), new ItemStack(Items.DYE, 3, 9), StackUtil.getNull(), 0);
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 7), new ItemStack(Items.DYE, 3, 9), StackUtil.getEmpty(), 0);
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 8), new ItemStack(Items.DYE, 3, 7), StackUtil.getNull(), 0);
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.RED_FLOWER, 1, 8), new ItemStack(Items.DYE, 3, 7), StackUtil.getEmpty(), 0);
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 0), new ItemStack(Items.DYE, 4, 11), StackUtil.getNull(), 0);
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 0), new ItemStack(Items.DYE, 4, 11), StackUtil.getEmpty(), 0);
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 1), new ItemStack(Items.DYE, 4, 13), StackUtil.getNull(), 0);
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 1), new ItemStack(Items.DYE, 4, 13), StackUtil.getEmpty(), 0);
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 4), new ItemStack(Items.DYE, 4, 1), StackUtil.getNull(), 0);
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 4), new ItemStack(Items.DYE, 4, 1), StackUtil.getEmpty(), 0);
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 5), new ItemStack(Items.DYE, 4, 9), StackUtil.getNull(), 0);
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.DOUBLE_PLANT, 1, 5), new ItemStack(Items.DYE, 4, 9), StackUtil.getEmpty(), 0);
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("oreRedstone", false), new ItemStack(Items.REDSTONE), 10, StackUtil.getNull(), 0, 0);
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("oreLapis", false), new ItemStack(Items.DYE, 1, 4), 12, StackUtil.getNull(), 0, 0);
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("oreRedstone", false), new ItemStack(Items.REDSTONE), 10, StackUtil.getEmpty(), 0, 0);
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("oreLapis", false), new ItemStack(Items.DYE, 1, 4), 12, StackUtil.getEmpty(), 0, 0);
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("coal", false), OreDictionary.getOres("dustCoal", false), 1, LIST, 0, 0);
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("oreCoal", false), new ItemStack(Items.COAL), 3, StackUtil.getNull(), 0, 0);
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("blockCoal", false), new ItemStack(Items.COAL), 9, StackUtil.getNull(), 0, 0);
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("oreQuartz", false), new ItemStack(Items.QUARTZ), 3, StackUtil.getNull(), 0, 0);
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("cobblestone", false), new ItemStack(Blocks.SAND), 1, StackUtil.getNull(), 0, 0);
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("oreCoal", false), new ItemStack(Items.COAL), 3, StackUtil.getEmpty(), 0, 0);
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("blockCoal", false), new ItemStack(Items.COAL), 9, StackUtil.getEmpty(), 0, 0);
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("oreQuartz", false), new ItemStack(Items.QUARTZ), 3, StackUtil.getEmpty(), 0, 0);
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("cobblestone", false), new ItemStack(Blocks.SAND), 1, StackUtil.getEmpty(), 0, 0);
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.GRAVEL), new ItemStack(Items.FLINT), new ItemStack(Items.FLINT), 50);
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("stone", false), OreDictionary.getOres("cobblestone", false), 1, LIST, 0, 0);
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()), new ItemStack(Items.SUGAR, 2), StackUtil.getNull(), 0);
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()), new ItemStack(Items.SUGAR, 2), StackUtil.getEmpty(), 0);
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.GLOWSTONE), new ItemStack(Items.GLOWSTONE_DUST, 4), StackUtil.getNull(), 0);
ActuallyAdditionsAPI.addCrusherRecipe(new ItemStack(Blocks.GLOWSTONE), new ItemStack(Items.GLOWSTONE_DUST, 4), StackUtil.getEmpty(), 0);
MISC_RECIPES.add(RecipeUtil.lastCrusherRecipe());
ActuallyAdditionsAPI.addCrusherRecipes(OreDictionary.getOres("oreNickel", false), OreDictionary.getOres("dustNickel", false), 2, OreDictionary.getOres("dustPlatinum", false), 1, 15);

View file

@ -81,7 +81,7 @@ public class RecipeBioMash extends IForgeRegistryEntry.Impl<IRecipe> implements
return new ItemStack(InitItems.itemMisc, amount, TheMiscItems.MASHED_FOOD.ordinal());
}
else{
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
@ -92,7 +92,7 @@ public class RecipeBioMash extends IForgeRegistryEntry.Impl<IRecipe> implements
@Override
public ItemStack getRecipeOutput(){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override

View file

@ -55,7 +55,7 @@ public class RecipePotionRingCharging extends IForgeRegistryEntry.Impl<IRecipe>
@Override
public ItemStack getCraftingResult(InventoryCrafting inv){
ItemStack inputRing = StackUtil.getNull();
ItemStack inputRing = StackUtil.getEmpty();
int totalBlaze = 0;
for(int i = 0; i < inv.getSizeInventory(); i++){
@ -80,7 +80,7 @@ public class RecipePotionRingCharging extends IForgeRegistryEntry.Impl<IRecipe>
}
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override
@ -90,7 +90,7 @@ public class RecipePotionRingCharging extends IForgeRegistryEntry.Impl<IRecipe>
@Override
public ItemStack getRecipeOutput(){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override

View file

@ -159,44 +159,44 @@ public class ContainerBag extends Container implements IButtonReactor{
if(this.isVoid || !this.filter.check(newStack) || !this.mergeItemStack(newStack, 4, 32, false)){
if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
//
}
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
if(!StackUtil.isValid(newStack)){
theSlot.putStack(StackUtil.getNull());
theSlot.putStack(StackUtil.getEmpty());
}
else{
theSlot.onSlotChanged();
}
if(StackUtil.getStackSize(newStack) == StackUtil.getStackSize(currentStack)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onTake(player, newStack);
return currentStack;
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player){
if(SlotFilter.checkFilter(this, slotId, player)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
else if(clickTypeIn == ClickType.SWAP && dragType == this.inventory.currentItem){
return null;
return ItemStack.EMPTY;
}
else{
return super.slotClick(slotId, dragType, clickTypeIn, player);

View file

@ -61,39 +61,39 @@ public class ContainerBioReactor extends Container{
//Shift from Inventory
if(TileEntityBioReactor.isValidItem(newStack)){
if(!this.mergeItemStack(newStack, 0, 8, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
//
else if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
if(!StackUtil.isValid(newStack)){
theSlot.putStack(StackUtil.getNull());
theSlot.putStack(StackUtil.getEmpty());
}
else{
theSlot.onSlotChanged();
}
if(StackUtil.getStackSize(newStack) == StackUtil.getStackSize(currentStack)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onTake(player, newStack);
return currentStack;
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override

View file

@ -64,33 +64,33 @@ public class ContainerBreaker extends Container{
//
if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
}
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
if(!StackUtil.isValid(newStack)){
theSlot.putStack(StackUtil.getNull());
theSlot.putStack(StackUtil.getEmpty());
}
else{
theSlot.onSlotChanged();
}
if(StackUtil.getStackSize(newStack) == StackUtil.getStackSize(currentStack)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onTake(player, newStack);
return currentStack;
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override

View file

@ -60,39 +60,39 @@ public class ContainerCanolaPress extends Container{
//Shift from Inventory
if(newStack.getItem() == InitItems.itemMisc && newStack.getItemDamage() == TheMiscItems.CANOLA.ordinal()){
if(!this.mergeItemStack(newStack, 0, 1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
//
else if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
if(!StackUtil.isValid(newStack)){
theSlot.putStack(StackUtil.getNull());
theSlot.putStack(StackUtil.getEmpty());
}
else{
theSlot.onSlotChanged();
}
if(StackUtil.getStackSize(newStack) == StackUtil.getStackSize(currentStack)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onTake(player, newStack);
return currentStack;
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override

View file

@ -59,39 +59,39 @@ public class ContainerCoalGenerator extends Container{
//Shift from Inventory
if(TileEntityFurnace.getItemBurnTime(newStack) > 0){
if(!this.mergeItemStack(newStack, 0, 1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
//
else if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
if(!StackUtil.isValid(newStack)){
theSlot.putStack(StackUtil.getNull());
theSlot.putStack(StackUtil.getEmpty());
}
else{
theSlot.onSlotChanged();
}
if(StackUtil.getStackSize(newStack) == StackUtil.getStackSize(currentStack)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onTake(player, newStack);
return currentStack;
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override

View file

@ -68,7 +68,7 @@ public class ContainerCoffeeMachine extends Container{
//Slots in Inventory to shift from
if(slot == TileEntityCoffeeMachine.SLOT_OUTPUT){
if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onSlotChange(newStack, currentStack);
}
@ -77,49 +77,49 @@ public class ContainerCoffeeMachine extends Container{
//Shift from Inventory
if(newStack.getItem() == InitItems.itemMisc && newStack.getItemDamage() == TheMiscItems.CUP.ordinal()){
if(!this.mergeItemStack(newStack, TileEntityCoffeeMachine.SLOT_INPUT, TileEntityCoffeeMachine.SLOT_INPUT+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(ItemCoffee.getIngredientFromStack(newStack) != null){
if(!this.mergeItemStack(newStack, 3, 11, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(newStack.getItem() == InitItems.itemCoffeeBean){
if(!this.mergeItemStack(newStack, TileEntityCoffeeMachine.SLOT_COFFEE_BEANS, TileEntityCoffeeMachine.SLOT_COFFEE_BEANS+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
//
else if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
if(!StackUtil.isValid(newStack)){
theSlot.putStack(StackUtil.getNull());
theSlot.putStack(StackUtil.getEmpty());
}
else{
theSlot.onSlotChanged();
}
if(StackUtil.getStackSize(newStack) == StackUtil.getStackSize(currentStack)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onTake(player, newStack);
return currentStack;
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override

View file

@ -64,33 +64,33 @@ public class ContainerDirectionalBreaker extends Container{
//
if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
}
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
if(!StackUtil.isValid(newStack)){
theSlot.putStack(StackUtil.getNull());
theSlot.putStack(StackUtil.getEmpty());
}
else{
theSlot.onSlotChanged();
}
if(StackUtil.getStackSize(newStack) == StackUtil.getStackSize(currentStack)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onTake(player, newStack);
return currentStack;
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override

View file

@ -81,45 +81,45 @@ public class ContainerDrill extends Container{
//Shift from Inventory
if(newStack.getItem() instanceof ItemDrillUpgrade){
if(!this.mergeItemStack(newStack, 0, 5, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
//
else if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
if(!StackUtil.isValid(newStack)){
theSlot.putStack(StackUtil.getNull());
theSlot.putStack(StackUtil.getEmpty());
}
else{
theSlot.onSlotChanged();
}
if(StackUtil.getStackSize(newStack) == StackUtil.getStackSize(currentStack)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onTake(player, newStack);
return currentStack;
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player){
if(clickTypeIn == ClickType.SWAP && dragType == this.inventory.currentItem){
return null;
return ItemStack.EMPTY;
}
else{
return super.slotClick(slotId, dragType, clickTypeIn, player);

View file

@ -64,33 +64,33 @@ public class ContainerDropper extends Container{
//
if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
}
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
if(!StackUtil.isValid(newStack)){
theSlot.putStack(StackUtil.getNull());
theSlot.putStack(StackUtil.getEmpty());
}
else{
theSlot.onSlotChanged();
}
if(StackUtil.getStackSize(newStack) == StackUtil.getStackSize(currentStack)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onTake(player, newStack);
return currentStack;
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override

View file

@ -88,7 +88,7 @@ public class ContainerEnergizer extends Container{
//Slots in Inventory to shift from
if(slot == 1){
if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onSlotChange(newStack, currentStack);
}
@ -97,39 +97,39 @@ public class ContainerEnergizer extends Container{
//Shift from Inventory
if((ActuallyAdditions.teslaLoaded && newStack.hasCapability(TeslaUtil.teslaConsumer, null)) || newStack.hasCapability(CapabilityEnergy.ENERGY, null)){
if(!this.mergeItemStack(newStack, 0, 1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
//
else if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
if(!StackUtil.isValid(newStack)){
theSlot.putStack(StackUtil.getNull());
theSlot.putStack(StackUtil.getEmpty());
}
else{
theSlot.onSlotChanged();
}
if(StackUtil.getStackSize(newStack) == StackUtil.getStackSize(currentStack)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onTake(player, newStack);
return currentStack;
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override

View file

@ -87,7 +87,7 @@ public class ContainerEnervator extends Container{
//Slots in Inventory to shift from
if(slot == 1){
if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onSlotChange(newStack, currentStack);
}
@ -96,39 +96,39 @@ public class ContainerEnervator extends Container{
//Shift from Inventory
if((ActuallyAdditions.teslaLoaded && newStack.hasCapability(TeslaUtil.teslaProducer, null)) || newStack.hasCapability(CapabilityEnergy.ENERGY, null)){
if(!this.mergeItemStack(newStack, 0, 1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
//
else if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
if(!StackUtil.isValid(newStack)){
theSlot.putStack(StackUtil.getNull());
theSlot.putStack(StackUtil.getEmpty());
}
else{
theSlot.onSlotChanged();
}
if(StackUtil.getStackSize(newStack) == StackUtil.getStackSize(currentStack)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onTake(player, newStack);
return currentStack;
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override

View file

@ -69,33 +69,33 @@ public class ContainerFarmer extends Container{
//
if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
}
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
if(!StackUtil.isValid(newStack)){
theSlot.putStack(StackUtil.getNull());
theSlot.putStack(StackUtil.getEmpty());
}
else{
theSlot.onSlotChanged();
}
if(StackUtil.getStackSize(newStack) == StackUtil.getStackSize(currentStack)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onTake(player, newStack);
return currentStack;
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override

View file

@ -59,33 +59,33 @@ public class ContainerFeeder extends Container{
//
if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
}
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
if(!StackUtil.isValid(newStack)){
theSlot.putStack(StackUtil.getNull());
theSlot.putStack(StackUtil.getEmpty());
}
else{
theSlot.onSlotChanged();
}
if(StackUtil.getStackSize(newStack) == StackUtil.getStackSize(currentStack)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onTake(player, newStack);
return currentStack;
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override

View file

@ -54,32 +54,32 @@ public class ContainerFermentingBarrel extends Container{
if(slot >= inventoryStart){
if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
if(!StackUtil.isValid(newStack)){
theSlot.putStack(StackUtil.getNull());
theSlot.putStack(StackUtil.getEmpty());
}
else{
theSlot.onSlotChanged();
}
if(StackUtil.getStackSize(newStack) == StackUtil.getStackSize(currentStack)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onTake(player, newStack);
return currentStack;
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override

View file

@ -78,41 +78,41 @@ public class ContainerFilter extends Container{
//
if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
if(!StackUtil.isValid(newStack)){
theSlot.putStack(StackUtil.getNull());
theSlot.putStack(StackUtil.getEmpty());
}
else{
theSlot.onSlotChanged();
}
if(StackUtil.getStackSize(newStack) == StackUtil.getStackSize(currentStack)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onTake(player, newStack);
return currentStack;
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player){
if(SlotFilter.checkFilter(this, slotId, player)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
else if(clickTypeIn == ClickType.SWAP && dragType == this.inventory.currentItem){
return null;
return ItemStack.EMPTY;
}
else{
return super.slotClick(slotId, dragType, clickTypeIn, player);

View file

@ -18,7 +18,7 @@ public class ContainerFireworkBox extends Container{
@Override
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index){
return null;
return ItemStack.EMPTY;
}
@Override

View file

@ -53,7 +53,7 @@ public class ContainerFluidCollector extends Container{
//Slots in Inventory to shift from
if(slot == 1){
if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onSlotChange(newStack, currentStack);
}
@ -61,32 +61,32 @@ public class ContainerFluidCollector extends Container{
else if(slot >= inventoryStart){
if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
if(!StackUtil.isValid(newStack)){
theSlot.putStack(StackUtil.getNull());
theSlot.putStack(StackUtil.getEmpty());
}
else{
theSlot.onSlotChanged();
}
if(StackUtil.getStackSize(newStack) == StackUtil.getStackSize(currentStack)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onTake(player, newStack);
return currentStack;
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override

View file

@ -61,7 +61,7 @@ public class ContainerFurnaceDouble extends Container{
//Slots in Inventory to shift from
if(slot == TileEntityFurnaceDouble.SLOT_OUTPUT_1 || slot == TileEntityFurnaceDouble.SLOT_OUTPUT_2){
if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onSlotChange(newStack, currentStack);
}
@ -71,7 +71,7 @@ public class ContainerFurnaceDouble extends Container{
if(StackUtil.isValid(FurnaceRecipes.instance().getSmeltingResult(newStack))){
if(!this.mergeItemStack(newStack, TileEntityFurnaceDouble.SLOT_INPUT_1, TileEntityFurnaceDouble.SLOT_INPUT_1+1, false)){
if(!this.mergeItemStack(newStack, TileEntityFurnaceDouble.SLOT_INPUT_2, TileEntityFurnaceDouble.SLOT_INPUT_2+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
}
@ -79,32 +79,32 @@ public class ContainerFurnaceDouble extends Container{
else if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
if(!StackUtil.isValid(newStack)){
theSlot.putStack(StackUtil.getNull());
theSlot.putStack(StackUtil.getEmpty());
}
else{
theSlot.onSlotChanged();
}
if(StackUtil.getStackSize(newStack) == StackUtil.getStackSize(currentStack)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onTake(player, newStack);
return currentStack;
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override

View file

@ -65,33 +65,33 @@ public class ContainerGiantChest extends Container{
//
if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
}
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
if(!StackUtil.isValid(newStack)){
theSlot.putStack(StackUtil.getNull());
theSlot.putStack(StackUtil.getEmpty());
}
else{
theSlot.onSlotChanged();
}
if(StackUtil.getStackSize(newStack) == StackUtil.getStackSize(currentStack)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onTake(player, newStack);
return currentStack;
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override

View file

@ -67,7 +67,7 @@ public class ContainerGrinder extends Container{
//Slots in Inventory to shift from
if(slot == TileEntityGrinder.SLOT_OUTPUT_1_1 || slot == TileEntityGrinder.SLOT_OUTPUT_1_2 || (this.isDouble && (slot == TileEntityGrinder.SLOT_OUTPUT_2_1 || slot == TileEntityGrinder.SLOT_OUTPUT_2_2))){
if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, true)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onSlotChange(newStack, currentStack);
}
@ -78,11 +78,11 @@ public class ContainerGrinder extends Container{
if(!this.mergeItemStack(newStack, TileEntityGrinder.SLOT_INPUT_1, TileEntityGrinder.SLOT_INPUT_1+1, false)){
if(this.isDouble){
if(!this.mergeItemStack(newStack, TileEntityGrinder.SLOT_INPUT_2, TileEntityGrinder.SLOT_INPUT_2+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else{
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
}
@ -90,32 +90,32 @@ public class ContainerGrinder extends Container{
else if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
if(!StackUtil.isValid(newStack)){
theSlot.putStack(StackUtil.getNull());
theSlot.putStack(StackUtil.getEmpty());
}
else{
theSlot.onSlotChanged();
}
if(StackUtil.getStackSize(newStack) == StackUtil.getStackSize(currentStack)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onTake(player, newStack);
return currentStack;
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override

View file

@ -76,39 +76,39 @@ public class ContainerInputter extends Container{
//
if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
}
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
if(!StackUtil.isValid(newStack)){
theSlot.putStack(StackUtil.getNull());
theSlot.putStack(StackUtil.getEmpty());
}
else{
theSlot.onSlotChanged();
}
if(StackUtil.getStackSize(newStack) == StackUtil.getStackSize(currentStack)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onTake(player, newStack);
return currentStack;
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player){
if(SlotFilter.checkFilter(this, slotId, player)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
else{
return super.slotClick(slotId, dragType, clickTypeIn, player);

View file

@ -64,38 +64,38 @@ public class ContainerLaserRelayItemWhitelist extends Container{
if(slot >= inventoryStart){
if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
if(!StackUtil.isValid(newStack)){
theSlot.putStack(StackUtil.getNull());
theSlot.putStack(StackUtil.getEmpty());
}
else{
theSlot.onSlotChanged();
}
if(StackUtil.getStackSize(newStack) == StackUtil.getStackSize(currentStack)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onTake(player, newStack);
return currentStack;
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player){
if(SlotFilter.checkFilter(this, slotId, player)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
else{
return super.slotClick(slotId, dragType, clickTypeIn, player);

View file

@ -64,33 +64,33 @@ public class ContainerMiner extends Container{
//
if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
}
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
if(!StackUtil.isValid(newStack)){
theSlot.putStack(StackUtil.getNull());
theSlot.putStack(StackUtil.getEmpty());
}
else{
theSlot.onSlotChanged();
}
if(StackUtil.getStackSize(newStack) == StackUtil.getStackSize(currentStack)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onTake(player, newStack);
return currentStack;
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override

View file

@ -53,32 +53,32 @@ public class ContainerOilGenerator extends Container{
if(slot >= inventoryStart){
if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
if(!StackUtil.isValid(newStack)){
theSlot.putStack(StackUtil.getNull());
theSlot.putStack(StackUtil.getEmpty());
}
else{
theSlot.onSlotChanged();
}
if(StackUtil.getStackSize(newStack) == StackUtil.getStackSize(currentStack)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onTake(player, newStack);
return currentStack;
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override

View file

@ -64,33 +64,33 @@ public class ContainerPhantomPlacer extends Container{
//
if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
}
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
if(!StackUtil.isValid(newStack)){
theSlot.putStack(StackUtil.getNull());
theSlot.putStack(StackUtil.getEmpty());
}
else{
theSlot.onSlotChanged();
}
if(StackUtil.getStackSize(newStack) == StackUtil.getStackSize(currentStack)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onTake(player, newStack);
return currentStack;
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override

View file

@ -71,39 +71,39 @@ public class ContainerRangedCollector extends Container{
//
if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
}
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
if(!StackUtil.isValid(newStack)){
theSlot.putStack(StackUtil.getNull());
theSlot.putStack(StackUtil.getEmpty());
}
else{
theSlot.onSlotChanged();
}
if(StackUtil.getStackSize(newStack) == StackUtil.getStackSize(currentStack)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onTake(player, newStack);
return currentStack;
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player){
if(SlotFilter.checkFilter(this, slotId, player)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
else{
return super.slotClick(slotId, dragType, clickTypeIn, player);

View file

@ -60,39 +60,39 @@ public class ContainerRepairer extends Container{
//Shift from Inventory
if(TileEntityItemRepairer.canBeRepaired(newStack)){
if(!this.mergeItemStack(newStack, TileEntityItemRepairer.SLOT_INPUT, TileEntityItemRepairer.SLOT_INPUT+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
//
else if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
if(!StackUtil.isValid(newStack)){
theSlot.putStack(StackUtil.getNull());
theSlot.putStack(StackUtil.getEmpty());
}
else{
theSlot.onSlotChanged();
}
if(StackUtil.getStackSize(newStack) == StackUtil.getStackSize(currentStack)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onTake(player, newStack);
return currentStack;
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override

View file

@ -18,7 +18,7 @@ public class ContainerSmileyCloud extends Container{
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
return null;
return ItemStack.EMPTY;
}
@Override

View file

@ -60,37 +60,37 @@ public class ContainerXPSolidifier extends Container{
if(slot >= inventoryStart){
if(newStack.getItem() instanceof ItemSolidifiedExperience){
if(!this.mergeItemStack(newStack, 1, 2, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(slot >= inventoryStart && slot <= inventoryEnd){
if(!this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(slot >= inventoryEnd+1 && slot < hotbarEnd+1 && !this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
else if(!this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
if(!StackUtil.isValid(newStack)){
theSlot.putStack(StackUtil.getNull());
theSlot.putStack(StackUtil.getEmpty());
}
else{
theSlot.onSlotChanged();
}
if(StackUtil.getStackSize(newStack) == StackUtil.getStackSize(currentStack)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
theSlot.onTake(player, newStack);
return currentStack;
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override

View file

@ -53,7 +53,7 @@ public class SlotFilter extends SlotItemHandlerUnconditioned{
player.inventory.setItemStack(stackInSlot);
}
this.putStack(StackUtil.getNull());
this.putStack(StackUtil.getEmpty());
}
else if(StackUtil.isValid(heldStack)){
if(!isFilter(stackInSlot)){

View file

@ -34,7 +34,7 @@ public class SlotImmovable extends Slot{
@Override
public ItemStack decrStackSize(int i){
return null;
return ItemStack.EMPTY;
}
@Override

View file

@ -34,7 +34,7 @@ public class SlotItemHandlerUnconditioned extends SlotItemHandler{
this.handler.setStackInSlot(this.getSlotIndex(), ItemStack.EMPTY);
ItemStack remainder = this.handler.insertItemInternal(this.getSlotIndex(), stack, true);
this.handler.setStackInSlot(this.getSlotIndex(), currentStack);
return remainder == null || remainder.getCount() < stack.getCount();
return remainder.isEmpty() || remainder.getCount() < stack.getCount();
}
return false;
}

View file

@ -12,7 +12,11 @@ package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
import de.ellpeck.actuallyadditions.mod.items.base.*;
import de.ellpeck.actuallyadditions.mod.items.base.ItemArmorAA;
import de.ellpeck.actuallyadditions.mod.items.base.ItemFoodSeed;
import de.ellpeck.actuallyadditions.mod.items.base.ItemHoeAA;
import de.ellpeck.actuallyadditions.mod.items.base.ItemSeed;
import de.ellpeck.actuallyadditions.mod.items.base.ItemSwordAA;
import de.ellpeck.actuallyadditions.mod.items.lens.ItemLens;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods;
@ -23,7 +27,6 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChestMedium;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
import de.ellpeck.actuallyadditions.mod.util.compat.CompatUtil;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.init.MobEffects;
@ -279,13 +282,9 @@ public final class InitItems{
itemHairyBall = new ItemHairyBall("item_hairy_ball");
itemCoffeeBean = new ItemCoffeeBean("item_coffee_beans");
itemRiceSeed = new ItemSeed("item_rice_seed", "seedRice", InitBlocks.blockRice, itemFoods, TheFoods.RICE.ordinal());
CompatUtil.registerMFRSeed(itemRiceSeed, InitBlocks.blockRice);
itemCanolaSeed = new ItemFoodSeed("item_canola_seed", "seedCanola", InitBlocks.blockCanola, itemMisc, TheMiscItems.CANOLA.ordinal(), 1, 0.01F, 10).setPotionEffect(new PotionEffect(MobEffects.NAUSEA, 1000, 0), 0.2F);
CompatUtil.registerMFRSeed(itemCanolaSeed, InitBlocks.blockCanola);
itemFlaxSeed = new ItemSeed("item_flax_seed", "seedFlax", InitBlocks.blockFlax, Items.STRING, 0);
CompatUtil.registerMFRSeed(itemFlaxSeed, InitBlocks.blockFlax);
itemCoffeeSeed = new ItemSeed("item_coffee_seed", "seedCoffeeBeans", InitBlocks.blockCoffee, itemCoffeeBean, 0);
CompatUtil.registerMFRSeed(itemCoffeeSeed, InitBlocks.blockCoffee);
itemPickaxeEmerald = new ItemPickaxeAA(InitToolMaterials.toolMaterialEmerald, new ItemStack(Items.EMERALD), "item_pickaxe_emerald", EnumRarity.EPIC);
itemAxeEmerald = new ItemAxeAA(InitToolMaterials.toolMaterialEmerald, new ItemStack(Items.EMERALD), "item_axe_emerald", EnumRarity.EPIC);
itemShovelEmerald = new ItemShovelAA(InitToolMaterials.toolMaterialEmerald, new ItemStack(Items.EMERALD), "item_shovel_emerald", EnumRarity.EPIC);

View file

@ -141,7 +141,7 @@ public class ItemDrill extends ItemEnergy{
public ItemStack getHasUpgradeAsStack(ItemStack stack, ItemDrillUpgrade.UpgradeType upgrade){
NBTTagCompound compound = stack.getTagCompound();
if(compound == null){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
ItemStackHandlerCustom inv = new ItemStackHandlerCustom(ContainerDrill.SLOT_AMOUNT);
@ -154,7 +154,7 @@ public class ItemDrill extends ItemEnergy{
}
}
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override

View file

@ -37,7 +37,7 @@ public class ItemEngineerGoggles extends ItemArmorAA implements IGoggles{
private final boolean displayMobs;
public ItemEngineerGoggles(String name, boolean displayMobs){
super(name, InitArmorMaterials.armorMaterialGoggles, 0, StackUtil.getNull());
super(name, InitArmorMaterials.armorMaterialGoggles, 0, StackUtil.getEmpty());
this.displayMobs = displayMobs;
this.setMaxDamage(0);

View file

@ -51,7 +51,7 @@ public class ItemFillingWand extends ItemEnergy{
if(StackUtil.isValid(slot) && slot.isItemEqual(stack)){
slot = StackUtil.addStackSize(slot, -1);
if(!StackUtil.isValid(slot)){
player.inventory.setInventorySlotContents(i, StackUtil.getNull());
player.inventory.setInventorySlotContents(i, StackUtil.getEmpty());
}
return true;

View file

@ -57,7 +57,7 @@ public class ItemWingsOfTheBats extends ItemBase{
return player.inventory.getStackInSlot(i);
}
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override

View file

@ -33,7 +33,7 @@ public class ItemToolAA extends ItemTool implements IDisableableItem{
private final boolean disabled;
public ItemToolAA(float attack, float speed, ToolMaterial toolMat, String repairItem, String unlocalizedName, EnumRarity rarity, Set<Block> effectiveStuff){
this(attack, speed, toolMat, (ItemStack)null, unlocalizedName, rarity, effectiveStuff);
this(attack, speed, toolMat, ItemStack.EMPTY, unlocalizedName, rarity, effectiveStuff);
this.repairOredict = repairItem;
}

View file

@ -46,7 +46,7 @@ public enum TheFoods{
public final boolean getsDrunken;
public final int useDuration;
public final EnumRarity rarity;
public ItemStack returnItem = StackUtil.getNull();
public ItemStack returnItem = StackUtil.getEmpty();
TheFoods(String name, int healAmount, float saturation, boolean getsDrunken, int useDuration, EnumRarity rarity){
this.name = name;

View file

@ -270,7 +270,7 @@ public class MethodHandler implements IMethodHandler{
outputOneCopy = StackUtil.setStackSize(outputOneCopy, outputOneAmounts);
if(outputTwos.isEmpty()){
ActuallyAdditionsAPI.addCrusherRecipe(input, outputOneCopy, StackUtil.getNull(), 0);
ActuallyAdditionsAPI.addCrusherRecipe(input, outputOneCopy, StackUtil.getEmpty(), 0);
hasWorkedOnce = true;
}
else{
@ -301,7 +301,7 @@ public class MethodHandler implements IMethodHandler{
outputOneCopy = StackUtil.setStackSize(outputOneCopy, outputOneAmount);
if(!StackUtil.isValid(outputTwo)){
ActuallyAdditionsAPI.addCrusherRecipe(input, outputOneCopy, StackUtil.getNull(), 0);
ActuallyAdditionsAPI.addCrusherRecipe(input, outputOneCopy, StackUtil.getEmpty(), 0);
hasWorkedOnce = true;
}
else if(StackUtil.isValid(outputTwo) && !CrusherRecipeRegistry.hasBlacklistedOutput(outputTwo, ConfigStringListValues.CRUSHER_OUTPUT_BLACKLIST.getValue())){

View file

@ -64,7 +64,7 @@ public class CactusFarmerBehavior implements IFarmerBehavior{
NonNullList<ItemStack> drops = NonNullList.create();
upState.getBlock().getDrops(drops, world, up, upState, 0);
if(drops != null && !drops.isEmpty()){
if(!drops.isEmpty()){
if(farmer.addToOutputInventory(drops, false)){
world.playEvent(2001, up, Block.getStateId(upState));
world.setBlockToAir(up);

View file

@ -57,7 +57,7 @@ public class MelonPumpkinFarmerBehavior implements IFarmerBehavior{
if(block == Blocks.PUMPKIN || block == Blocks.MELON_BLOCK){
NonNullList<ItemStack> drops = NonNullList.create();
block.getDrops(drops, world, pos, state, 0);
if(drops != null && !drops.isEmpty()){
if(!drops.isEmpty()){
if(farmer.addToOutputInventory(drops, false)){
world.playEvent(2001, pos, Block.getStateId(state));
world.setBlockToAir(pos);

View file

@ -50,19 +50,19 @@ public class NetherWartFarmerBehavior implements IFarmerBehavior{
IBlockState state = world.getBlockState(pos);
if(state.getBlock() instanceof BlockNetherWart){
if(state.getValue(BlockNetherWart.AGE) >= 3){
NonNullList<ItemStack> output = NonNullList.create();
state.getBlock().getDrops(output, world, pos, state, 0);
if(output != null && !output.isEmpty()){
boolean toInput = farmer.addToSeedInventory(output, false);
if(toInput || farmer.addToOutputInventory(output, false)){
NonNullList<ItemStack> drops = NonNullList.create();
state.getBlock().getDrops(drops, world, pos, state, 0);
if(!drops.isEmpty()){
boolean toInput = farmer.addToSeedInventory(drops, false);
if(toInput || farmer.addToOutputInventory(drops, false)){
world.playEvent(2001, pos, Block.getStateId(state));
world.setBlockToAir(pos);
if(toInput){
farmer.addToSeedInventory(output, true);
farmer.addToSeedInventory(drops, true);
}
else{
farmer.addToOutputInventory(output, true);
farmer.addToOutputInventory(drops, true);
}
farmer.extractEnergy(use);

View file

@ -57,7 +57,7 @@ public class ReedFarmerBehavior implements IFarmerBehavior{
NonNullList<ItemStack> drops = NonNullList.create();
upState.getBlock().getDrops(drops, world, pos, state, 0);
if(drops != null && !drops.isEmpty()){
if(!drops.isEmpty()){
if(farmer.addToOutputInventory(drops, false)){
world.playEvent(2001, up, Block.getStateId(upState));
world.setBlockToAir(up);

View file

@ -85,7 +85,7 @@ public class SpecialRenderInit{
return new ItemStack(block, 1, meta);
}
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@SubscribeEvent(priority = EventPriority.HIGHEST)

View file

@ -39,7 +39,7 @@ public final class CrusherRecipeRegistry{
if(ore.substring(0, theCase.theCase.length()).equals(theCase.theCase)){
String output = theCase.resultPreString+ore.substring(theCase.theCase.length());
List<ItemStack> outputs = OreDictionary.getOres(output, false);
if(!ActuallyAdditionsAPI.methodHandler.addCrusherRecipes(OreDictionary.getOres(ore, false), outputs.isEmpty() ? StackUtil.getNull() : outputs.get(0), theCase.resultAmount, StackUtil.getNull(), 0, 0)){
if(!ActuallyAdditionsAPI.methodHandler.addCrusherRecipes(OreDictionary.getOres(ore, false), outputs.isEmpty() ? StackUtil.getEmpty() : outputs.get(0), theCase.resultAmount, StackUtil.getEmpty(), 0, 0)){
if(!oresNoResult.contains(ore)){
oresNoResult.add(ore);
}
@ -102,7 +102,7 @@ public final class CrusherRecipeRegistry{
public static ItemStack getOutputOnes(ItemStack input){
CrusherRecipe recipe = getRecipeFromInput(input);
return recipe == null ? StackUtil.getNull() : recipe.outputOneStack;
return recipe == null ? StackUtil.getEmpty() : recipe.outputOneStack;
}
public static CrusherRecipe getRecipeFromInput(ItemStack input){
@ -116,7 +116,7 @@ public final class CrusherRecipeRegistry{
public static ItemStack getOutputTwos(ItemStack input){
CrusherRecipe recipe = getRecipeFromInput(input);
return recipe == null ? StackUtil.getNull() : recipe.outputTwoStack;
return recipe == null ? StackUtil.getEmpty() : recipe.outputTwoStack;
}
public static int getOutputTwoChance(ItemStack input){

View file

@ -101,7 +101,7 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
int theSlot = WorldUtil.findFirstFilledSlot(this.slots);
this.slots.setStackInSlot(theSlot, WorldUtil.useItemAtSide(sideToManipulate, this.world, this.pos, this.slots.getStackInSlot(theSlot)));
if(!StackUtil.isValid(this.slots.getStackInSlot(theSlot))){
this.slots.setStackInSlot(theSlot, StackUtil.getNull());
this.slots.setStackInSlot(theSlot, StackUtil.getEmpty());
}
}
}

View file

@ -83,7 +83,7 @@ public class TileEntityDropper extends TileEntityInventoryBase{
return slot;
}
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override

View file

@ -90,7 +90,7 @@ public class TileEntityFishingNet extends TileEntityBase{
stack = cap.insertItem(i, stack, false);
if(!StackUtil.isValid(stack)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
}

View file

@ -52,7 +52,7 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
ItemStack second = slots.getStackInSlot(slot2);
if(StackUtil.isValid(first) || StackUtil.isValid(second)){
ItemStack toSplit = StackUtil.getNull();
ItemStack toSplit = StackUtil.getEmpty();
if(!StackUtil.isValid(first) && StackUtil.isValid(second) && StackUtil.getStackSize(second) > 1){
toSplit = second;
}

View file

@ -71,7 +71,7 @@ public abstract class TileEntityInventoryBase extends TileEntityBase{
NBTTagList tagList = compound.getTagList("Items", 10);
for(int i = 0; i < slots.getSlots(); i++){
NBTTagCompound tagCompound = tagList.getCompoundTagAt(i);
slots.setStackInSlot(i, tagCompound != null && tagCompound.hasKey("id") ? new ItemStack(tagCompound) : StackUtil.getNull());
slots.setStackInSlot(i, tagCompound != null && tagCompound.hasKey("id") ? new ItemStack(tagCompound) : StackUtil.getEmpty());
}
}
}

View file

@ -81,7 +81,7 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase{
if(!StackUtil.isValid(this.slots.getStackInSlot(SLOT_OUTPUT)) && canBeRepaired(input)){
if(input.getItemDamage() <= 0){
this.slots.setStackInSlot(SLOT_OUTPUT, input.copy());
this.slots.setStackInSlot(SLOT_INPUT, StackUtil.getNull());
this.slots.setStackInSlot(SLOT_INPUT, StackUtil.getEmpty());
this.nextRepairTick = 0;
}
else{

View file

@ -70,7 +70,7 @@ public class TileEntityItemViewer extends TileEntityBase{
if(handler != null && handler.isLoaded()){
return handler.handler.getStackInSlot(handler.switchedIndex);
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override
@ -101,7 +101,7 @@ public class TileEntityItemViewer extends TileEntityBase{
return extracted;
}
}
return StackUtil.getNull();
return StackUtil.getEmpty();
}
@Override

View file

@ -148,7 +148,7 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements
int theSlot = WorldUtil.findFirstFilledSlot(this.slots);
this.slots.setStackInSlot(theSlot, WorldUtil.useItemAtSide(WorldUtil.getDirectionBySidesInOrder(this.side), this.world, this.boundPosition, this.slots.getStackInSlot(theSlot)));
if(!StackUtil.isValid(this.slots.getStackInSlot(theSlot))){
this.slots.setStackInSlot(theSlot, StackUtil.getNull());
this.slots.setStackInSlot(theSlot, StackUtil.getEmpty());
}
}
}

View file

@ -99,7 +99,7 @@ public final class AwfulUtil{
public static void callTheFuckinPolice(Object... stuff) {
int i = 0;
String error = "Actually Additions: Something is incredibly wrong. I don't know what you did, or how this method got called. But something is just completely wrong. This method was provided with ";
String error = "Actually Additions: Something is very wrong. This method was provided with ";
for(Object k : stuff) {
error += ("\n" + i++ + ": " + (k == null ? "null" : (k.getClass().getSimpleName() + " <- CLASS | INSTANCE -> " + k.toString() + ", ")));
}

View file

@ -34,7 +34,7 @@ public class ItemStackHandlerCustom extends ItemStackHandler{
@Override
public ItemStack insertItem(int slot, ItemStack stack, boolean simulate){
if(!StackUtil.isValid(stack)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
this.validateSlotIndex(slot);
@ -81,27 +81,27 @@ public class ItemStackHandlerCustom extends ItemStackHandler{
@Override
public ItemStack extractItem(int slot, int amount, boolean simulate){
if(amount <= 0){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
this.validateSlotIndex(slot);
ItemStack existing = this.stacks.get(slot);
if(!StackUtil.isValid(existing)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
int toExtract = Math.min(amount, existing.getMaxStackSize());
if(toExtract <= 0){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
if(!this.tempIgnoreConditions && !this.canExtract(this.getStackInSlot(slot), slot)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
if(existing.getCount() <= toExtract){
if(!simulate){
this.stacks.set(slot, StackUtil.getNull());
this.stacks.set(slot, StackUtil.getEmpty());
this.onContentsChanged(slot);
return existing;
}

View file

@ -24,6 +24,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import java.util.Arrays;
import java.util.List;
@ -31,11 +32,7 @@ import java.util.List;
public final class ItemUtil{
public static Item getItemFromName(String name){
ResourceLocation resLoc = new ResourceLocation(name);
if(Item.REGISTRY.containsKey(resLoc)){
return Item.REGISTRY.getObject(resLoc);
}
return null;
return ForgeRegistries.ITEMS.getValue(new ResourceLocation(name));
}
public static void registerBlock(Block block, ItemBlockBase itemBlock, String name, boolean addTab){

View file

@ -22,7 +22,7 @@ public final class StackUtil{
return stack.copy();
}
else{
return getNull();
return getEmpty();
}
}
@ -31,18 +31,18 @@ public final class StackUtil{
return stack;
}
else{
return getNull();
return getEmpty();
}
}
public static boolean isValid(ItemStack stack){//Stacks are nonnull. If we are making null stacks we're stupid anyway.
if(stack == null) AwfulUtil.callTheFuckinPolice("Oh yeah some idiot somewhere threw a null itemstack at us, might've been us, but whatever");
public static boolean isValid(ItemStack stack){
if(stack == null) AwfulUtil.callTheFuckinPolice("Null ItemStack detected", stack);
Item i = stack.getItem();
if(i instanceof IDisableableItem) return !((IDisableableItem) i).isDisabled();
return !stack.isEmpty();
}
public static ItemStack getNull(){
public static ItemStack getEmpty(){
return ItemStack.EMPTY;
}
@ -65,7 +65,7 @@ public final class StackUtil{
return stack.getItem().getContainerItem(stack);
}
else{
return getNull();
return getEmpty();
}
}
stack.setCount(size);
@ -91,7 +91,7 @@ public final class StackUtil{
}
public static NonNullList<ItemStack> createSlots(int size){
return NonNullList.withSize(size, getNull());
return NonNullList.withSize(size, getEmpty());
}

View file

@ -80,7 +80,7 @@ public final class WorldUtil{
}
public static ItemStack extractItem(SlotlessableItemHandlerWrapper extractWrapper, int maxExtract, boolean simulate, int slotStart, int slotEnd, FilterSettings filter){
ItemStack extracted = StackUtil.getNull();
ItemStack extracted = StackUtil.getEmpty();
if(ActuallyAdditions.commonCapsLoaded){
Object handler = extractWrapper.getSlotlessHandler();
@ -444,7 +444,7 @@ public final class WorldUtil{
if(StackUtil.getStackSize(stack) <= 0 && stack == player.getHeldItemMainhand()){
ForgeEventFactory.onPlayerDestroyItem(player, stack, EnumHand.MAIN_HAND);
player.setHeldItem(EnumHand.MAIN_HAND, null);
player.setHeldItem(EnumHand.MAIN_HAND, ItemStack.EMPTY);
}
if(ConfigBoolValues.ENABLE_DRILL_DIGGING_PACKET.isEnabled()){

View file

@ -36,7 +36,7 @@ public final class CommonCapsUtil{
}
if(!StackUtil.isValid(remain)){
return StackUtil.getNull();
return StackUtil.getEmpty();
}
}
}

View file

@ -11,52 +11,11 @@
package de.ellpeck.actuallyadditions.mod.util.compat;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerCrafter;
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import net.minecraft.block.Block;
import net.minecraft.block.BlockCrops;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.event.FMLInterModComms;
import java.lang.reflect.Method;
public final class CompatUtil{
public static void registerPlant(Block block){
registerMFRPlant(block);
registerBloodMagicPlant(block);
}
private static void registerMFRPlant(Block block){
FMLInterModComms.sendMessage("MineFactoryReloaded", "registerHarvestable_Crop", new ItemStack(block, 1, 7));
NBTTagCompound compound = new NBTTagCompound();
compound.setString("plant", block.getRegistryName().toString());
FMLInterModComms.sendMessage("MineFactoryReloaded", "registerFertilizable_Crop", compound);
}
public static void registerMFRSeed(Item item, Block plant){
NBTTagCompound compound = new NBTTagCompound();
compound.setString("seed", item.getRegistryName().toString());
compound.setString("crop", plant.getRegistryName().toString());
FMLInterModComms.sendMessage("MineFactoryReloaded", "registerPlantable_Crop", compound);
}
private static void registerBloodMagicPlant(Block block){
if(Loader.isModLoaded("bloodmagic")){
try{
Class<?> regClass = Class.forName("WayofTime.bloodmagic.api.registry.HarvestRegistry");
Method regMethod = regClass.getDeclaredMethod("registerStandardCrop", Block.class, int.class);
regMethod.invoke(null, block, ((BlockCrops)block).getMaxAge());
}
catch(Exception e){
ModUtil.LOGGER.error("Failed to add farming compatibility for Blood Magic!", e);
}
}
}
public static void registerCraftingTweaksCompat(){
NBTTagCompound tagCompound = new NBTTagCompound();
tagCompound.setString("ContainerClass", ContainerCrafter.class.getName());