mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-22 19:39:24 +01:00
Better check
This commit is contained in:
parent
213716fc46
commit
348b1eb92c
2 changed files with 9 additions and 1 deletions
|
@ -74,7 +74,7 @@ public abstract class ExUPlantFarmerBehavior implements IFarmerBehavior{
|
|||
if(block.getMetaFromState(state) >= this.getMaxStage()){
|
||||
NonNullList<ItemStack> drops = NonNullList.create();
|
||||
block.getDrops(drops, world, pos, state, 0);
|
||||
if(drops.isEmpty()) return FarmerResult.FAIL;
|
||||
if(StackUtil.isEmpty(drops)) return FarmerResult.FAIL;
|
||||
for(ItemStack stack : drops){
|
||||
if(StackUtil.isValid(stack)){
|
||||
ResourceLocation itemReg = stack.getItem().getRegistryName();
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
package de.ellpeck.actuallyadditions.mod.util;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import de.ellpeck.actuallyadditions.api.misc.IDisableableItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -93,6 +95,12 @@ public final class StackUtil{
|
|||
public static NonNullList<ItemStack> createSlots(int size){
|
||||
return NonNullList.withSize(size, getEmpty());
|
||||
}
|
||||
|
||||
public static boolean isEmpty(Collection<ItemStack> stacks) {
|
||||
if(stacks.isEmpty()) return true;
|
||||
else for(ItemStack s : stacks) if (!s.isEmpty()) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue