use of crazypants.enderio.conduits.gui.ExternalConnectionContainer in project EnderIO by SleepyTrousers.
the class AbstractConduitPacket method getConduit.
@SuppressWarnings("unchecked")
@Nullable
public T getConduit(MessageContext ctx) {
if (ctx.side == Side.SERVER) {
if (ctx.getServerHandler().player.openContainer instanceof ExternalConnectionContainer) {
final TileConduitBundle tileEntity = ((ExternalConnectionContainer) ctx.getServerHandler().player.openContainer).getTileEntity();
if (tileEntity == null || !tileEntity.getPos().equals(getPos())) {
Log.warn("Player " + ctx.getServerHandler().player.getName() + " tried to manipulate conduit while having another conduit's GUI open!");
return null;
}
} else {
if (BlockCoord.get(ctx.getServerHandler().player).distanceSq(getPos()) > EnderIO.proxy.getReachDistanceForPlayer(ctx.getServerHandler().player)) {
Log.warn("Player " + ctx.getServerHandler().player.getName() + " tried to manipulate conduit without having its GUI open or being near it!");
return null;
}
}
}
World world = getWorld(ctx);
TileEntity tileEntity = getTileEntity(world);
if (tileEntity instanceof IConduitBundle) {
return (T) ((IConduitBundle) tileEntity).getConduit(getConType());
}
return null;
}
Aggregations