mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-27 01:08: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.items.base.ItemBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.FilterSettings;
|
import de.ellpeck.actuallyadditions.mod.tile.FilterSettings;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
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.StackUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
|
||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.EnumRarity;
|
import net.minecraft.item.EnumRarity;
|
||||||
|
@ -101,7 +99,7 @@ public class ItemBag extends ItemBase{
|
||||||
filter.readFromNBT(invStack.getTagCompound(), "Filter");
|
filter.readFromNBT(invStack.getTagCompound(), "Filter");
|
||||||
if(filter.check(stack, inventory)){
|
if(filter.check(stack, inventory)){
|
||||||
if(isVoid){
|
if(isVoid){
|
||||||
stack = StackUtil.setStackSize(stack, 0);
|
stack.stackSize = 0;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
@ -112,14 +110,14 @@ public class ItemBag extends ItemBase{
|
||||||
int maxTransfer = Math.min(StackUtil.getStackSize(stack), stack.getMaxStackSize()-StackUtil.getStackSize(bagStack));
|
int maxTransfer = Math.min(StackUtil.getStackSize(stack), stack.getMaxStackSize()-StackUtil.getStackSize(bagStack));
|
||||||
if(maxTransfer > 0){
|
if(maxTransfer > 0){
|
||||||
inventory[j] = StackUtil.addStackSize(bagStack, maxTransfer);
|
inventory[j] = StackUtil.addStackSize(bagStack, maxTransfer);
|
||||||
stack = StackUtil.addStackSize(stack, -maxTransfer);
|
stack.stackSize -= maxTransfer;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
inventory[j] = stack.copy();
|
inventory[j] = stack.copy();
|
||||||
stack = StackUtil.setStackSize(stack, 0);
|
stack.stackSize = 0;
|
||||||
changed = true;
|
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