Fixed bug where the GUI didn't close when a block is broken, causing a dupe bug with the Portable Grid, fixes #1275

This commit is contained in:
raoulvdberge
2017-06-05 00:13:19 +02:00
parent a59a8726d6
commit 744201ed30
2 changed files with 10 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ import com.raoulvdberge.refinedstorage.RSUtils;
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNode;
import com.raoulvdberge.refinedstorage.api.network.node.INetworkNodeProxy;
import com.raoulvdberge.refinedstorage.api.network.security.Permission;
import com.raoulvdberge.refinedstorage.container.ContainerBase;
import com.raoulvdberge.refinedstorage.integration.mcmp.IntegrationMCMP;
import com.raoulvdberge.refinedstorage.integration.mcmp.RSMCMPAddon;
import com.raoulvdberge.refinedstorage.item.ItemBlockBase;
@@ -114,6 +115,12 @@ public abstract class BlockBase extends Block {
public void breakBlock(World world, BlockPos pos, IBlockState state) {
dropContents(world, pos);
removeTile(world, pos, state);
for (EntityPlayer player : world.playerEntities) {
if (player.openContainer instanceof ContainerBase && ((ContainerBase) player.openContainer).getTile() != null && ((ContainerBase) player.openContainer).getTile().getPos().equals(pos)) {
player.closeScreen();
}
}
}
protected void removeTile(World world, BlockPos pos, IBlockState state) {