protected @Nonnull World getWorld(MessageContext ctx) { if (ctx.side == Side.SERVER) { return ctx.getServerHandler().player.world; } else { final World clientWorld = EnderCore.proxy.getClientWorld(); if (clientWorld == null) { throw new NullPointerException("Recieved network packet ouside any world!"); } return clientWorld; } }
/** * Returns the {@link Scheduler} instance for the current side. * * @see #schedule(int, Runnable) * * @return The {@link Scheduler} instance. */ public static Scheduler instance() { return EnderCore.proxy.getScheduler(); }
@SuppressWarnings("null") @Override public void stopWithErrorScreen(String... message) { EnderIOCrashCallable.registerStopScreenMessage(message); List<String> lines = new ArrayList<String>(); for (String string : message) { Log.error(string); if (string.length() > 71) { lines.addAll(splitString(string, 71)); } else { lines.add(string); } } EnderCore.proxy.throwModCompatibilityError(lines.toArray(new String[lines.size()])); }
@EventHandler public void preInit(@Nonnull FMLPreInitializationEvent event) { ConfigHandler.configFolder = event.getModConfigurationDirectory(); ConfigHandler.enderConfigFolder = new File(ConfigHandler.configFolder.getPath() + "/" + MODID); ConfigHandler.configFile = new File(ConfigHandler.enderConfigFolder.getPath() + "/" + event.getSuggestedConfigurationFile().getName()); if (!ConfigHandler.configFile.exists() && event.getSuggestedConfigurationFile().exists()) { try { FileUtils.copyFile(event.getSuggestedConfigurationFile(), ConfigHandler.configFile); } catch (IOException e) { Throwables.propagate(e); } EnderFileUtils.safeDelete(event.getSuggestedConfigurationFile()); } ConfigHandler.instance().initialize(NullHelper.notnullJ(ConfigHandler.configFile, "it was there a second ago, I swear!")); Handlers.preInit(event); CompatRegistry.INSTANCE.handle(event); proxy.onPreInit(event); }
@Override public IMessage onMessage(PacketProgress message, MessageContext ctx) { TileEntity tile = message.getTileEntity(EnderCore.proxy.getClientWorld()); if (tile instanceof IProgressTile) { ((IProgressTile) tile).setProgress(message.progress); } return null; } }