mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 16:58:34 +01:00
Supposedly fixed the bag leaking items when other mods don't allow the event
This commit is contained in:
parent
23f491f376
commit
27793630ea
1 changed files with 5 additions and 14 deletions
|
@ -16,9 +16,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler.GuiTypes;
|
|||
import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
|
||||
import de.ellpeck.actuallyadditions.mod.tile.FilterSettings;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
|
@ -69,7 +67,7 @@ public class ItemBag extends ItemBase{
|
|||
}
|
||||
|
||||
// don't count the filter 4 slots
|
||||
slotsTotal = slotsTotal - 4;
|
||||
slotsTotal = slotsTotal-4;
|
||||
|
||||
tooltip.add(TextFormatting.ITALIC.toString()+slotsFilled+"/"+slotsTotal+" filled slots");
|
||||
}
|
||||
|
@ -101,7 +99,7 @@ public class ItemBag extends ItemBase{
|
|||
filter.readFromNBT(invStack.getTagCompound(), "Filter");
|
||||
if(filter.check(stack, inventory)){
|
||||
if(isVoid){
|
||||
stack = StackUtil.setStackSize(stack, 0);
|
||||
stack.stackSize = 0;
|
||||
changed = true;
|
||||
}
|
||||
else{
|
||||
|
@ -112,14 +110,14 @@ public class ItemBag extends ItemBase{
|
|||
int maxTransfer = Math.min(StackUtil.getStackSize(stack), stack.getMaxStackSize()-StackUtil.getStackSize(bagStack));
|
||||
if(maxTransfer > 0){
|
||||
inventory[j] = StackUtil.addStackSize(bagStack, maxTransfer);
|
||||
stack = StackUtil.addStackSize(stack, -maxTransfer);
|
||||
stack.stackSize -= maxTransfer;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
inventory[j] = stack.copy();
|
||||
stack = StackUtil.setStackSize(stack, 0);
|
||||
stack.stackSize = 0;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
|
@ -145,13 +143,6 @@ public class ItemBag extends ItemBase{
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!StackUtil.isValid(stack)){
|
||||
item.setDead();
|
||||
}
|
||||
else{
|
||||
item.setEntityItemStack(stack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue