use of crazypants.enderio.base.network.IRemoteExec in project EnderIO by SleepyTrousers.
the class GuiHandler method getGuiElement.
@Nullable
protected Object getGuiElement(boolean server, int a, EntityPlayer player, World world, int b, int c, int d) {
if (player == null || world == null) {
return null;
}
int facingI = a & 0xFF;
EnumFacing facing = facingI == 0xFF ? null : EnumFacing.values()[facingI];
int id = a >>> 8;
long posl = ((long) c << 32) | (b & 0xffffffffL);
BlockPos pos = BlockPos.fromLong(posl);
int param2 = b, param3 = c, param1 = d;
Registerable mo = GuiHelper.getFromID(id);
IEioGuiHandler handler = mo.getBlock() instanceof IEioGuiHandler ? (IEioGuiHandler) mo.getBlock() : mo.getItem() instanceof IEioGuiHandler ? (IEioGuiHandler) mo.getItem() : null;
if (handler != null) {
Log.debug("Opening GUI for ", mo, ": isServer=", server, " id=", id, " player=", player, " world=", world, " pos=", pos, " facing=", facing, " param1=", param1, " param2=", param2, " param3=", param3);
final Object guiElement = handler.getGuiElement(server, player, world, pos, facing, param1, param2, param3);
if (guiElement instanceof IRemoteExec) {
((IRemoteExec) guiElement).setGuiID(id);
}
return guiElement;
} else {
Log.error("Failed to open GUI ", id, " because ", mo, " is no GUI handler");
return null;
}
}
Aggregations