mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 00:38:35 +01:00
Ensure holding of the sack. Closes #975
This commit is contained in:
parent
ea06819f38
commit
3bbf2c3d4a
3 changed files with 11 additions and 8 deletions
|
@ -39,11 +39,13 @@ public class ContainerBag extends Container implements IButtonReactor{
|
|||
private final boolean isVoid;
|
||||
public boolean autoInsert;
|
||||
private boolean oldAutoInsert;
|
||||
private final ItemStack sack;
|
||||
|
||||
public ContainerBag(InventoryPlayer inventory, boolean isVoid){
|
||||
public ContainerBag(ItemStack sack, InventoryPlayer inventory, boolean isVoid){
|
||||
this.inventory = inventory;
|
||||
this.bagInventory = new ItemStackHandlerCustom(getSlotAmount(isVoid));
|
||||
this.isVoid = isVoid;
|
||||
this.sack = sack;
|
||||
|
||||
for(int i = 0; i < 4; i++){
|
||||
this.addSlotToContainer(new SlotFilter(this.filter, i, 155, 10+i*18));
|
||||
|
@ -217,7 +219,7 @@ public class ContainerBag extends Container implements IButtonReactor{
|
|||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player){
|
||||
return true;
|
||||
return player.getHeldItemMainhand() == sack;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -100,9 +100,9 @@ public class GuiHandler implements IGuiHandler{
|
|||
case LASER_RELAY_ITEM_WHITELIST:
|
||||
return new ContainerLaserRelayItemWhitelist(player.inventory, tile);
|
||||
case BAG:
|
||||
return new ContainerBag(player.inventory, false);
|
||||
return new ContainerBag(player.getHeldItemMainhand(), player.inventory, false);
|
||||
case VOID_BAG:
|
||||
return new ContainerBag(player.inventory, true);
|
||||
return new ContainerBag(player.getHeldItemMainhand(), player.inventory, true);
|
||||
case BIO_REACTOR:
|
||||
return new ContainerBioReactor(player.inventory, tile);
|
||||
case FARMER:
|
||||
|
@ -197,9 +197,9 @@ public class GuiHandler implements IGuiHandler{
|
|||
case LASER_RELAY_ITEM_WHITELIST:
|
||||
return new GuiLaserRelayItemWhitelist(player.inventory, tile);
|
||||
case BAG:
|
||||
return new GuiBag(player.inventory, false);
|
||||
return new GuiBag(player.getHeldItemMainhand(), player.inventory, false);
|
||||
case VOID_BAG:
|
||||
return new GuiBag(player.inventory, true);
|
||||
return new GuiBag(player.getHeldItemMainhand(), player.inventory, true);
|
||||
case BIO_REACTOR:
|
||||
return new GuiBioReactor(player.inventory, tile);
|
||||
case FARMER:
|
||||
|
|
|
@ -20,6 +20,7 @@ import net.minecraft.client.Minecraft;
|
|||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
|
@ -41,8 +42,8 @@ public class GuiBag extends GuiWtfMojang{
|
|||
private FilterSettingsGui filter;
|
||||
private GuiButton buttonAutoInsert;
|
||||
|
||||
public GuiBag(InventoryPlayer inventory, boolean isVoid){
|
||||
this(isVoid, new ContainerBag(inventory, isVoid));
|
||||
public GuiBag(ItemStack sack, InventoryPlayer inventory, boolean isVoid){
|
||||
this(isVoid, new ContainerBag(sack, inventory, isVoid));
|
||||
}
|
||||
|
||||
private GuiBag(boolean isVoid, ContainerBag container){
|
||||
|
|
Loading…
Reference in a new issue