Skip to content

Commit

Permalink
Added tile checks for GUIs
Browse files Browse the repository at this point in the history
  • Loading branch information
DrParadox7 committed Dec 11, 2022
1 parent 884dff3 commit cf4c800
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ FMP_version=1.2.0.347
CCLIB_version=1.1.3.141
NEI_version=1.0.5.120
CCC_version=1.0.7.48
mod_version=9.10.19-LE
mod_version=9.10.19a-LE
alt_version=9, 10, 19
6 changes: 6 additions & 0 deletions src/main/java/mekanism/client/gui/GuiMekanism.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import mekanism.common.tile.TileEntityContainerBlock;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
Expand Down Expand Up @@ -285,4 +286,9 @@ protected FontRenderer getFontRenderer()
{
return fontRendererObj;
}

public boolean canInteractWith(EntityPlayer entityPlayer)
{
return tileEntity.isUseableByPlayer(entityPlayer);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@ public void setInventorySlotContents(int slotID, ItemStack itemstack)
@Override
public boolean isUseableByPlayer(EntityPlayer entityplayer)
{
return !isInvalid();
if (isInvalid())
return false;

return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) == this && entityplayer.getDistanceSq(this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord +0.5) < 64;
}

@Override
Expand Down

0 comments on commit cf4c800

Please sign in to comment.