mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +01:00
Update state when dropper gui closes (fixes #972)
This commit is contained in:
parent
2a751355d7
commit
da573459cb
3 changed files with 16 additions and 7 deletions
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.inventory;
|
package de.ellpeck.actuallyadditions.mod.inventory;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned;
|
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper;
|
||||||
|
@ -24,10 +25,12 @@ import net.minecraft.item.ItemStack;
|
||||||
public class ContainerDropper extends Container{
|
public class ContainerDropper extends Container{
|
||||||
|
|
||||||
private final TileEntityDropper dropper;
|
private final TileEntityDropper dropper;
|
||||||
|
EntityPlayer player;
|
||||||
|
|
||||||
public ContainerDropper(InventoryPlayer inventory, TileEntityBase tile){
|
public ContainerDropper(EntityPlayer player, TileEntityBase tile){
|
||||||
this.dropper = (TileEntityDropper)tile;
|
this.dropper = (TileEntityDropper)tile;
|
||||||
|
this.player = player;
|
||||||
|
InventoryPlayer inventory = player.inventory;
|
||||||
for(int i = 0; i < 3; i++){
|
for(int i = 0; i < 3; i++){
|
||||||
for(int j = 0; j < 3; j++){
|
for(int j = 0; j < 3; j++){
|
||||||
this.addSlotToContainer(new SlotItemHandlerUnconditioned(this.dropper.slots, j+i*3, 62+j*18, 21+i*18));
|
this.addSlotToContainer(new SlotItemHandlerUnconditioned(this.dropper.slots, j+i*3, 62+j*18, 21+i*18));
|
||||||
|
@ -97,4 +100,10 @@ public class ContainerDropper extends Container{
|
||||||
public boolean canInteractWith(EntityPlayer player){
|
public boolean canInteractWith(EntityPlayer player){
|
||||||
return this.dropper.canPlayerUse(player);
|
return this.dropper.canPlayerUse(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onContainerClosed(EntityPlayer playerIn) {
|
||||||
|
super.onContainerClosed(playerIn);
|
||||||
|
if (!player.isSpectator()) dropper.getWorld().notifyNeighborsOfStateChange(dropper.getPos(), InitBlocks.blockDropper, false);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -64,7 +64,7 @@ public class GuiHandler implements IGuiHandler{
|
||||||
case BREAKER:
|
case BREAKER:
|
||||||
return new ContainerBreaker(player.inventory, tile);
|
return new ContainerBreaker(player.inventory, tile);
|
||||||
case DROPPER:
|
case DROPPER:
|
||||||
return new ContainerDropper(player.inventory, tile);
|
return new ContainerDropper(player, tile);
|
||||||
case CANOLA_PRESS:
|
case CANOLA_PRESS:
|
||||||
return new ContainerCanolaPress(player.inventory, tile);
|
return new ContainerCanolaPress(player.inventory, tile);
|
||||||
case FERMENTING_BARREL:
|
case FERMENTING_BARREL:
|
||||||
|
@ -146,7 +146,7 @@ public class GuiHandler implements IGuiHandler{
|
||||||
case BREAKER:
|
case BREAKER:
|
||||||
return new GuiBreaker(player.inventory, tile);
|
return new GuiBreaker(player.inventory, tile);
|
||||||
case DROPPER:
|
case DROPPER:
|
||||||
return new GuiDropper(player.inventory, tile);
|
return new GuiDropper(player, tile);
|
||||||
case CANOLA_PRESS:
|
case CANOLA_PRESS:
|
||||||
return new GuiCanolaPress(player.inventory, tile);
|
return new GuiCanolaPress(player.inventory, tile);
|
||||||
case FERMENTING_BARREL:
|
case FERMENTING_BARREL:
|
||||||
|
|
|
@ -15,7 +15,7 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
@ -26,8 +26,8 @@ public class GuiDropper extends GuiWtfMojang{
|
||||||
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_breaker");
|
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_breaker");
|
||||||
private final TileEntityDropper dropper;
|
private final TileEntityDropper dropper;
|
||||||
|
|
||||||
public GuiDropper(InventoryPlayer inventory, TileEntityBase tile){
|
public GuiDropper(EntityPlayer player, TileEntityBase tile){
|
||||||
super(new ContainerDropper(inventory, tile));
|
super(new ContainerDropper(player, tile));
|
||||||
this.dropper = (TileEntityDropper)tile;
|
this.dropper = (TileEntityDropper)tile;
|
||||||
this.xSize = 176;
|
this.xSize = 176;
|
||||||
this.ySize = 93+86;
|
this.ySize = 93+86;
|
||||||
|
|
Loading…
Reference in a new issue