Mod ContainerFix by Tschipp

  • ContainerFix by Tschipp

    ContainerFix fixes a common issue with Containers not closing properly
    • 13.01 KB
    • 1.13.2
    • March 16, 2018
    • April 20, 2019
    • Miscellaneous
    ContainerFix
Mod Information
NameContainerFixAuthorTschippDescriptionContainerFix fixes a common issue with Containers not closing properly
InformationDownloads:
Version: 1.13.2
Size: 13.01 KB
Updated at: April 20, 2019
Created at: March 16, 2018
Tags
Miscellaneous

ContainerFix fixes a common issue with many mods that doesn't close

the Gui of a Container, even if that container is destroyed or removed somehow.

 

 

This mod is supposed to be used in conjunction with other mods.

This bug was discovered by Darkosto.

 

For modders:

If you want to fix this issue for your mod, override Container#canInteractWith. In there, you would do a check if the TileEntity of the container still exists in the world, and if the player is close enough to the Block. This would mimic vanilla behavior.

 

Example:

@Override
public boolean canInteractWith(EntityPlayer player)
{
return te.world.getTileEntity(te.getPos()) == te && player.getDistanceSq(te.pos.add(0.5, 0.5, 0.5)) <= 64;
}