diff --git a/patches/minecraft/net/minecraft/client/Minecraft.java.patch b/patches/minecraft/net/minecraft/client/Minecraft.java.patch index df83ecd05b..c3858b485a 100644 --- a/patches/minecraft/net/minecraft/client/Minecraft.java.patch +++ b/patches/minecraft/net/minecraft/client/Minecraft.java.patch @@ -280,18 +280,7 @@ } private void func_184117_aA() { -@@ -1676,6 +1716,10 @@ - this.field_71424_I.func_76320_a("waitForServer"); - - while(!this.field_71437_Z.func_71200_ad()) { -+ if (!net.minecraftforge.fml.StartupQuery.check() || this.field_71437_Z.func_71241_aa()) { -+ this.func_147108_a(null); -+ return; -+ } else if (this.field_71462_r == null) // if we're showing nothing, put the working screen back again - worldloadprogressscreen.func_231023_e_(); - this.func_195542_b(false); - -@@ -1696,7 +1740,12 @@ +@@ -1696,7 +1736,12 @@ networkmanager.func_150719_a(new ClientLoginNetHandler(networkmanager, this, (Screen)null, (p_229998_0_) -> { })); networkmanager.func_179290_a(new CHandshakePacket(socketaddress.toString(), 0, ProtocolType.LOGIN)); @@ -305,7 +294,7 @@ this.field_71453_ak = networkmanager; } else { this.func_241559_a_(p_238195_6_, p_238195_1_, flag, () -> { -@@ -1770,6 +1819,7 @@ +@@ -1770,6 +1815,7 @@ } public void func_71403_a(ClientWorld p_71403_1_) { @@ -313,7 +302,7 @@ WorkingScreen workingscreen = new WorkingScreen(); workingscreen.func_200210_a(new TranslationTextComponent("connect.joining")); this.func_213241_c(workingscreen); -@@ -1801,10 +1851,12 @@ +@@ -1801,10 +1847,12 @@ IntegratedServer integratedserver = this.field_71437_Z; this.field_71437_Z = null; this.field_71460_t.func_190564_k(); @@ -326,7 +315,7 @@ if (integratedserver != null) { this.field_71424_I.func_76320_a("waitForServer"); -@@ -1819,6 +1871,7 @@ +@@ -1819,6 +1867,7 @@ this.field_71456_v.func_181029_i(); this.field_71422_O = null; this.field_71455_al = false; @@ -334,7 +323,7 @@ this.field_213274_aO.func_216815_b(); } -@@ -1849,6 +1902,7 @@ +@@ -1849,6 +1898,7 @@ this.field_71452_i.func_78870_a(p_213257_1_); TileEntityRendererDispatcher.field_147556_a.func_147543_a(p_213257_1_); this.func_230150_b_(); @@ -342,7 +331,7 @@ } public boolean func_238216_r_() { -@@ -1894,112 +1948,9 @@ +@@ -1894,112 +1944,9 @@ private void func_147112_ai() { if (this.field_71476_x != null && this.field_71476_x.func_216346_c() != RayTraceResult.Type.MISS) { @@ -458,7 +447,7 @@ } } -@@ -2081,6 +2032,7 @@ +@@ -2081,6 +2028,7 @@ return field_71432_P; } @@ -466,7 +455,7 @@ public CompletableFuture func_213245_w() { return this.func_213169_a(this::func_213237_g).thenCompose((p_229993_0_) -> { return p_229993_0_; -@@ -2388,7 +2340,7 @@ +@@ -2388,7 +2336,7 @@ supplier = func_228022_c_(supplier); } @@ -475,7 +464,7 @@ } private static Supplier func_228021_b_(Supplier p_228021_0_) { -@@ -2407,6 +2359,14 @@ +@@ -2407,6 +2355,14 @@ this.field_175617_aL.func_229355_a_(p_228020_1_); } diff --git a/patches/minecraft/net/minecraft/server/Main.java.patch b/patches/minecraft/net/minecraft/server/Main.java.patch index 5ac67d9511..868da96837 100644 --- a/patches/minecraft/net/minecraft/server/Main.java.patch +++ b/patches/minecraft/net/minecraft/server/Main.java.patch @@ -1,14 +1,15 @@ --- a/net/minecraft/server/Main.java +++ b/net/minecraft/server/Main.java -@@ -72,6 +72,7 @@ +@@ -72,6 +72,8 @@ OptionSpec optionspec11 = optionparser.accepts("port").withRequiredArg().ofType(Integer.class).defaultsTo(-1); OptionSpec optionspec12 = optionparser.accepts("serverId").withRequiredArg(); OptionSpec optionspec13 = optionparser.nonOptions(); ++ optionparser.accepts("allowUpdates").withRequiredArg().ofType(Boolean.class).defaultsTo(Boolean.TRUE); // Forge: allow mod updates to proceed + optionparser.accepts("gameDir").withRequiredArg().ofType(File.class).defaultsTo(new File(".")); //Forge: Consume this argument, we use it in the launcher, and the client side. try { OptionSet optionset = optionparser.parse(p_main_0_); -@@ -79,32 +80,36 @@ +@@ -79,32 +81,36 @@ optionparser.printHelpOn(System.err); return; } @@ -52,7 +53,7 @@ SaveFormat saveformat = SaveFormat.func_237269_a_(file1.toPath()); SaveFormat.LevelSave saveformat$levelsave = saveformat.func_237274_c_(s); MinecraftServer.func_240777_a_(saveformat$levelsave); -@@ -170,6 +175,7 @@ +@@ -170,6 +176,7 @@ Thread thread = new Thread("Server Shutdown Thread") { public void run() { dedicatedserver.func_71263_m(true); diff --git a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch index 22d562f05c..349697d632 100644 --- a/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch +++ b/patches/minecraft/net/minecraft/server/MinecraftServer.java.patch @@ -41,7 +41,7 @@ this.field_211151_aa = Util.func_211177_b(); this.field_147147_p.func_151315_a(new StringTextComponent(this.field_71286_C)); this.field_147147_p.func_151321_a(new ServerStatusResponse.Version(SharedConstants.func_215069_a().getName(), SharedConstants.func_215069_a().getProtocolVersion())); -@@ -646,9 +650,15 @@ +@@ -646,7 +650,10 @@ this.func_240795_b_(longtickdetector); this.field_71296_Q = true; } @@ -51,13 +51,8 @@ + net.minecraftforge.fml.server.ServerLifecycleHooks.expectServerStopped(); // has to come before finalTick to avoid race conditions this.func_71228_a((CrashReport)null); } -+ } catch (net.minecraftforge.fml.StartupQuery.AbortedException e) { -+ // ignore silently -+ net.minecraftforge.fml.server.ServerLifecycleHooks.expectServerStopped(); // has to come before finalTick to avoid race conditions } catch (Throwable throwable1) { - field_147145_h.error("Encountered an unexpected exception", throwable1); - CrashReport crashreport; -@@ -665,6 +675,7 @@ +@@ -665,6 +672,7 @@ field_147145_h.error("We were unable to save this crash report to disk."); } @@ -65,7 +60,7 @@ this.func_71228_a(crashreport); } finally { try { -@@ -673,6 +684,7 @@ +@@ -673,6 +681,7 @@ } catch (Throwable throwable) { field_147145_h.error("Exception stopping the server", throwable); } finally { @@ -73,7 +68,7 @@ this.func_71240_o(); } -@@ -774,6 +786,7 @@ +@@ -774,6 +783,7 @@ protected void func_71217_p(BooleanSupplier p_71217_1_) { long i = Util.func_211178_c(); @@ -81,7 +76,7 @@ ++this.field_71315_w; this.func_71190_q(p_71217_1_); if (i - this.field_147142_T >= 5000000000L) { -@@ -788,6 +801,7 @@ +@@ -788,6 +798,7 @@ Collections.shuffle(Arrays.asList(agameprofile)); this.field_147147_p.func_151318_b().func_151330_a(agameprofile); @@ -89,7 +84,7 @@ } if (this.field_71315_w % 6000 == 0) { -@@ -815,6 +829,7 @@ +@@ -815,6 +826,7 @@ long i1 = Util.func_211178_c(); this.field_213215_ap.func_181747_a(i1 - i); this.field_71304_b.func_76319_b(); @@ -97,7 +92,7 @@ } protected void func_71190_q(BooleanSupplier p_71190_1_) { -@@ -822,7 +837,8 @@ +@@ -822,7 +834,8 @@ this.func_193030_aL().func_73660_a(); this.field_71304_b.func_219895_b("levels"); @@ -107,7 +102,7 @@ this.field_71304_b.func_194340_a(() -> { return serverworld + " " + serverworld.func_234923_W_().func_240901_a_(); }); -@@ -833,6 +849,7 @@ +@@ -833,6 +846,7 @@ } this.field_71304_b.func_76320_a("tick"); @@ -115,7 +110,7 @@ try { serverworld.func_72835_b(p_71190_1_); -@@ -841,9 +858,11 @@ +@@ -841,9 +855,11 @@ serverworld.func_72914_a(crashreport); throw new ReportedException(crashreport); } @@ -127,7 +122,7 @@ } this.field_71304_b.func_219895_b("connection"); -@@ -918,7 +937,7 @@ +@@ -918,7 +934,7 @@ } public String getServerModName() { @@ -136,7 +131,7 @@ } public CrashReport func_71230_b(CrashReport p_71230_1_) { -@@ -931,6 +950,7 @@ +@@ -931,6 +947,7 @@ p_71230_1_.func_85056_g().func_189529_a("Data Packs", () -> { StringBuilder stringbuilder = new StringBuilder(); @@ -144,7 +139,7 @@ for(ResourcePackInfo resourcepackinfo : this.field_195577_ad.func_198980_d()) { if (stringbuilder.length() > 0) { stringbuilder.append(", "); -@@ -1275,6 +1295,7 @@ +@@ -1275,6 +1292,7 @@ this.func_184103_al().func_193244_w(); this.field_200258_al.func_240946_a_(this.field_195576_ac.func_240960_a_()); this.field_240765_ak_.func_195410_a(this.field_195576_ac.func_240970_h_()); @@ -152,7 +147,7 @@ }, this); if (this.func_213162_bc()) { this.func_213161_c(completablefuture::isDone); -@@ -1284,10 +1305,13 @@ +@@ -1284,10 +1302,13 @@ } public static DatapackCodec func_240772_a_(ResourcePackList p_240772_0_, DatapackCodec p_240772_1_, boolean p_240772_2_) { @@ -168,7 +163,7 @@ } else { Set set = Sets.newLinkedHashSet(); -@@ -1437,6 +1461,31 @@ +@@ -1437,6 +1458,31 @@ public abstract boolean func_213199_b(GameProfile p_213199_1_); @@ -200,7 +195,7 @@ public void func_223711_a(Path p_223711_1_) throws IOException { Path path = p_223711_1_.resolve("levels"); -@@ -1564,4 +1613,8 @@ +@@ -1564,4 +1610,8 @@ public IServerConfiguration func_240793_aU_() { return this.field_240768_i_; } diff --git a/patches/minecraft/net/minecraft/world/storage/SaveFormat.java.patch b/patches/minecraft/net/minecraft/world/storage/SaveFormat.java.patch index b6ef7843c8..b8afa03b26 100644 --- a/patches/minecraft/net/minecraft/world/storage/SaveFormat.java.patch +++ b/patches/minecraft/net/minecraft/world/storage/SaveFormat.java.patch @@ -11,7 +11,7 @@ return (p_237261_2_, p_237261_3_) -> { try { CompoundNBT compoundnbt = CompressedStreamTools.func_74796_a(new FileInputStream(p_237261_2_)); -@@ -180,7 +184,12 @@ +@@ -180,7 +184,10 @@ Pair pair = func_237259_a_(dynamic, p_237261_3_, i); VersionData versiondata = VersionData.func_237324_a_(dynamic); WorldSettings worldsettings = WorldSettings.func_234951_a_(dynamic, p_237270_1_); @@ -20,12 +20,10 @@ + if (levelSave != null) + net.minecraftforge.fml.WorldPersistenceHooks.handleWorldDataLoad(levelSave, info, compoundnbt); + return info; -+ } catch (net.minecraftforge.fml.StartupQuery.AbortedException e) { -+ throw e; } catch (Exception exception) { field_215785_a.error("Exception reading {}", p_237261_2_, exception); return null; -@@ -301,7 +310,7 @@ +@@ -301,7 +308,7 @@ @Nullable public IServerConfiguration func_237284_a_(DynamicOps p_237284_1_, DatapackCodec p_237284_2_) { this.func_237301_i_(); @@ -34,7 +32,7 @@ } @Nullable -@@ -322,6 +331,8 @@ +@@ -322,6 +329,8 @@ CompoundNBT compoundnbt1 = new CompoundNBT(); compoundnbt1.func_218657_a("Data", compoundnbt); @@ -43,7 +41,7 @@ try { File file2 = File.createTempFile("level", ".dat", file1); CompressedStreamTools.func_74799_a(compoundnbt1, new FileOutputStream(file2)); -@@ -339,6 +350,10 @@ +@@ -339,6 +348,10 @@ return this.field_237279_c_.resolve("icon.png").toFile(); } diff --git a/src/main/java/net/minecraftforge/fml/FMLWorldPersistenceHook.java b/src/main/java/net/minecraftforge/fml/FMLWorldPersistenceHook.java index 7dbf3c118d..0109f0b3a0 100644 --- a/src/main/java/net/minecraftforge/fml/FMLWorldPersistenceHook.java +++ b/src/main/java/net/minecraftforge/fml/FMLWorldPersistenceHook.java @@ -109,12 +109,7 @@ public final class FMLWorldPersistenceHook implements WorldPersistenceHooks.Worl Multimap failedElements = null; - if (tag.contains("ModItemData") || tag.contains("ItemData")) // Pre 1.7 - { - StartupQuery.builder().text("This save predates 1.7.10, it can no longer be loaded here. Please load in 1.7.10 or 1.8 first").notification(); - StartupQuery.abort(); - } - else if (tag.contains("Registries")) // 1.8, genericed out the 'registries' list + if (tag.contains("Registries")) // 1.8, genericed out the 'registries' list { Map snapshot = new HashMap<>(); CompoundNBT regs = tag.getCompound("Registries"); @@ -137,9 +132,6 @@ public final class FMLWorldPersistenceHook implements WorldPersistenceHooks.Worl buf.append("Missing ").append(name).append(":\n"); entries.forEach(rl -> buf.append(" ").append(rl).append("\n")); }); - - StartupQuery.builder().text(buf.toString()).notification(); - StartupQuery.abort(); } } } diff --git a/src/main/java/net/minecraftforge/fml/SidedProvider.java b/src/main/java/net/minecraftforge/fml/SidedProvider.java index caa7b74353..7026bb9a10 100644 --- a/src/main/java/net/minecraftforge/fml/SidedProvider.java +++ b/src/main/java/net/minecraftforge/fml/SidedProvider.java @@ -45,12 +45,7 @@ public enum SidedProvider STRIPCHARS( (Function, Function>)c-> ClientHooks::stripSpecialChars, s-> str->str, - ()-> str->str), - @SuppressWarnings("Convert2MethodRef") // need to not be methodrefs to avoid classloading all of StartupQuery's data (supplier is coming from StartupQuery) - STARTUPQUERY( - c->StartupQuery.QueryWrapperClient.clientQuery(c), - s->StartupQuery.QueryWrapperServer.dedicatedServerQuery(s), - ()-> { throw new UnsupportedOperationException(); }); + ()-> str->str); private static Supplier client; private static Supplier server; diff --git a/src/main/java/net/minecraftforge/fml/StartupQuery.java b/src/main/java/net/minecraftforge/fml/StartupQuery.java deleted file mode 100644 index 8107f422d1..0000000000 --- a/src/main/java/net/minecraftforge/fml/StartupQuery.java +++ /dev/null @@ -1,386 +0,0 @@ -/* - * Minecraft Forge - * Copyright (c) 2016-2020. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation version 2.1 - * of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -package net.minecraftforge.fml; - -import java.util.Iterator; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.function.Consumer; -import java.util.function.Supplier; - -import javax.annotation.Nullable; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.apache.logging.log4j.Marker; -import org.apache.logging.log4j.MarkerManager; - -import com.google.common.base.Strings; - -import net.minecraft.client.Minecraft; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.dedicated.DedicatedServer; -import net.minecraft.server.dedicated.PendingCommand; -import net.minecraftforge.fml.client.gui.screen.ConfirmationScreen; -import net.minecraftforge.fml.client.gui.screen.NotificationScreen; -import net.minecraftforge.fml.common.thread.EffectiveSide; -import net.minecraftforge.fml.loading.FMLEnvironment; -import net.minecraftforge.fml.server.ServerLifecycleHooks; - -public class StartupQuery { - - public static class QueryBuilder - { - private String header = ""; - private String text = ""; - private String action = ""; - - QueryBuilder() {} - - public QueryBuilder header(String header) - { - this.header = Strings.nullToEmpty(header); - return this; - } - - public QueryBuilder text(String text) - { - this.text = Strings.nullToEmpty(text); - return this; - } - - public QueryBuilder action(String action) - { - this.action = Strings.nullToEmpty(action); - return this; - } - - public boolean confirm() - { - return build(new AtomicBoolean()).getResult(); - } - - public void notification() - { - build(null); - } - - private StartupQuery build(AtomicBoolean result) - { - StartupQuery query = new StartupQuery(header, text, action, new AtomicBoolean()); - query.execute(); - return query; - } - } - - // internal class/functionality, do not use - private static final Logger LOGGER = LogManager.getLogger(); - private static final Marker SQ = MarkerManager.getMarker("STARTUPQUERY"); - - public static QueryBuilder builder() - { - return new QueryBuilder(); - } - - private InterruptedException exception; - - public static void abort() - { - MinecraftServer server = ServerLifecycleHooks.getCurrentServer(); - if (server != null) server.initiateShutdown(false); - - throw new AbortedException(); // to halt the server - } - - public static boolean pendingQuery() { - return pending != null; - } - public static void reset() - { - pending = null; - } - - public static boolean check() - { - if (pending != null) - { - try - { - try - { - SidedProvider.STARTUPQUERY.>get().accept(pending); - } - catch (RuntimeException e) - { - LOGGER.error(SQ,"An exception occurred during startup query handling", e); - } - pending.throwException(); - } - catch (InterruptedException e) - { - LOGGER.warn(SQ, "query interrupted"); - abort(); - } - - pending = null; - } - - return true; - } - - private void throwException() throws InterruptedException - { - if (exception != null) throw exception; - } - - private static volatile StartupQuery pending; - - - private StartupQuery(String header, String text, String action, @Nullable AtomicBoolean result) - { - this.header = header; - this.text = text; - this.action = action; - this.result = result; - } - - @Nullable - public Boolean getResult() - { - return result == null ? null : result.get(); - } - - public void setResult(boolean result) - { - this.result.set(result); - } - - public String getHeader() - { - return header; - } - - public String getText() - { - return text; - } - - public String getAction() - { - return action; - } - - public boolean isSynchronous() - { - return synchronous; - } - - public void finish() - { - signal.countDown(); - } - - private void execute() - { - String prop = System.getProperty("fml.queryResult"); - - if (result != null && prop != null) - { - LOGGER.info(SQ, "Using fml.queryResult {} to answer the following query:\n{}", prop, text); - - if (prop.equalsIgnoreCase("confirm")) - { - setResult(true); - return; - } - else if (prop.equalsIgnoreCase("cancel")) - { - setResult(false); - return; - } - - LOGGER.warn(SQ, "Invalid value for fml.queryResult: {}, expected confirm or cancel", prop); - } - - synchronous = false; - pending = this; // let the other thread start the query - - // from the integrated server thread: the client will eventually check pending and execute the query - // from the client thread: synchronous execution - // dedicated server: command handling in mc is synchronous, execute the server-side query directly - if (FMLEnvironment.dist.isDedicatedServer() || EffectiveSide.get() == LogicalSide.CLIENT) - { - synchronous = true; - check(); - } - - try - { - signal.await(); - reset(); - } - catch (InterruptedException e) - { - LOGGER.warn(SQ, "query interrupted"); - abort(); - } - } - - private final String header; - private final String text; - private final String action; - @Nullable - private AtomicBoolean result; - private CountDownLatch signal = new CountDownLatch(1); - private volatile boolean synchronous; - - - /** - * Exception not being caught by the crash report generation logic. - */ - public static class AbortedException extends RuntimeException - { - private static final long serialVersionUID = -5933665223696833921L; - - private AbortedException() - { - super(); - } - } - - - public static class QueryWrapperClient { - public static Consumer clientQuery(Supplier clientSupplier) { - return (query) -> { - Minecraft client = clientSupplier.get(); - if (query.getResult() == null) { - client.displayGuiScreen(new NotificationScreen(query)); - } else { - client.displayGuiScreen(new ConfirmationScreen(query)); - } - - if (query.isSynchronous()) { - while (client.currentScreen instanceof NotificationScreen) { - if (Thread.interrupted()) { - query.exception = new InterruptedException(); - throw new RuntimeException(); - } - - try { - Thread.sleep(50); - } catch (InterruptedException ie) { - query.exception = ie; - } - } - } - }; - } - } - - public static class QueryWrapperServer { - public static Consumer dedicatedServerQuery(Supplier serverSupplier) - { - return (query) -> { - DedicatedServer server = serverSupplier.get(); - if (query.getResult() == null) - { - if (!query.getHeader().isEmpty()) - { - LOGGER.warn(SQ, "\n" + query.getHeader() + "\n"); - } - LOGGER.warn(SQ, "\n" + query.getText()); - if (!query.getAction().isEmpty()) - { - LOGGER.warn(SQ, "\n\n" + query.getAction()); - } - query.finish(); - } - else - { - StringBuilder text = new StringBuilder("\n"); - if (!query.getHeader().isEmpty()) { - text.append(query.getHeader()).append("\n\n"); - } - text.append(query.getText()).append("\n"); - if (!query.getAction().isEmpty()) { - text.append("\n").append(query.getAction()); - } - text.append("\nConfirm with '/fml confirm' or cancel with '/fml cancel'.") - .append("\nAlternatively start the server with -Dfml.queryResult=confirm or -Dfml.queryResult=cancel to preselect the answer."); - LOGGER.warn(SQ, text); - - if (!query.isSynchronous()) return; // no-op until mc does commands in another thread (if ever) - - boolean done = false; - - while (!done && server.isServerRunning()) - { - if (Thread.interrupted()) - { - query.exception = new InterruptedException(); - throw new RuntimeException(); - } - - DedicatedServer dedServer = (DedicatedServer)server; - - // rudimentary command processing, check for fml confirm/cancel and stop commands - synchronized (dedServer.pendingCommandList) - { - for (Iterator it = dedServer.pendingCommandList.iterator(); it.hasNext(); ) - { - String cmd = it.next().command.trim().toLowerCase(); - cmd = cmd.charAt(0) == '/' ? cmd.substring(1) : cmd; // strip the forward slash to make it optional - - if (cmd.equals("fml confirm")) - { - LOGGER.info(SQ, "confirmed"); - query.setResult(true); - done = true; - it.remove(); - } - else if (cmd.equals("fml cancel")) - { - LOGGER.info(SQ, "cancelled"); - query.setResult(false); - done = true; - it.remove(); - } - else if (cmd.equals("stop")) - { - StartupQuery.abort(); - } - } - } - try - { - Thread.sleep(10L); - } - catch (InterruptedException ie) - { - query.exception = ie; - } - } - - query.finish(); - } - }; - } - } -} diff --git a/src/main/java/net/minecraftforge/fml/WorldPersistenceHooks.java b/src/main/java/net/minecraftforge/fml/WorldPersistenceHooks.java index 30511627a7..b6137c7552 100644 --- a/src/main/java/net/minecraftforge/fml/WorldPersistenceHooks.java +++ b/src/main/java/net/minecraftforge/fml/WorldPersistenceHooks.java @@ -42,10 +42,7 @@ public class WorldPersistenceHooks public static void handleWorldDataLoad(SaveFormat.LevelSave levelSave, IServerConfiguration serverInfo, CompoundNBT tagCompound) { - if (EffectiveSide.get() == LogicalSide.SERVER) - { - worldPersistenceHooks.forEach(wac->wac.readData(levelSave, serverInfo, tagCompound.getCompound(wac.getModId()))); - } + worldPersistenceHooks.forEach(wac->wac.readData(levelSave, serverInfo, tagCompound.getCompound(wac.getModId()))); } public interface WorldPersistenceHook diff --git a/src/main/java/net/minecraftforge/fml/client/ClientHooks.java b/src/main/java/net/minecraftforge/fml/client/ClientHooks.java index 8717059860..79093cc683 100644 --- a/src/main/java/net/minecraftforge/fml/client/ClientHooks.java +++ b/src/main/java/net/minecraftforge/fml/client/ClientHooks.java @@ -66,8 +66,6 @@ import net.minecraft.resources.FallbackResourceManager; import net.minecraft.resources.IResourcePack; import net.minecraft.resources.SimpleReloadableResourceManager; import net.minecraft.util.ResourceLocation; -import net.minecraft.world.storage.WorldSummary; -import net.minecraftforge.fml.StartupQuery; import net.minecraftforge.fml.common.ObfuscationReflectionHelper; import net.minecraftforge.forgespi.language.IModInfo; import net.minecraftforge.fml.packs.ModFileResourcePack; @@ -183,19 +181,6 @@ public class ClientHooks return new File(Minecraft.getInstance().gameDir, "saves"); } - public static void tryLoadExistingWorld(WorldSelectionScreen selectWorldGUI, WorldSummary comparator) - { - try - { - //TODO - //Minecraft.getInstance().launchIntegratedServer(comparator.getFileName(), comparator.getDisplayName(), null); - } - catch (StartupQuery.AbortedException e) - { - // ignore - } - } - private static NetworkManager getClientToServerNetworkManager() { return Minecraft.getInstance().getConnection()!=null ? Minecraft.getInstance().getConnection().getNetworkManager() : null; diff --git a/src/main/java/net/minecraftforge/fml/client/gui/screen/ConfirmationScreen.java b/src/main/java/net/minecraftforge/fml/client/gui/screen/ConfirmationScreen.java index ba37dd367d..d8f8d59c86 100644 --- a/src/main/java/net/minecraftforge/fml/client/gui/screen/ConfirmationScreen.java +++ b/src/main/java/net/minecraftforge/fml/client/gui/screen/ConfirmationScreen.java @@ -15,7 +15,8 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ + *//* + package net.minecraftforge.fml.client.gui.screen; import net.minecraft.client.gui.widget.button.Button; @@ -50,3 +51,4 @@ public class ConfirmationScreen extends NotificationScreen )); } } +*/ diff --git a/src/main/java/net/minecraftforge/fml/client/gui/screen/NotificationScreen.java b/src/main/java/net/minecraftforge/fml/client/gui/screen/NotificationScreen.java index 514c7c359a..838777b82d 100644 --- a/src/main/java/net/minecraftforge/fml/client/gui/screen/NotificationScreen.java +++ b/src/main/java/net/minecraftforge/fml/client/gui/screen/NotificationScreen.java @@ -15,7 +15,8 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ + *//* + package net.minecraftforge.fml.client.gui.screen; @@ -24,10 +25,8 @@ import net.minecraft.client.gui.widget.button.Button; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.resources.I18n; import net.minecraft.util.text.TranslationTextComponent; import net.minecraftforge.client.gui.ScrollPanel; -import net.minecraftforge.fml.StartupQuery; public class NotificationScreen extends Screen { @@ -131,3 +130,4 @@ public class NotificationScreen extends Screen } } } +*/ diff --git a/src/main/java/net/minecraftforge/registries/GameData.java b/src/main/java/net/minecraftforge/registries/GameData.java index 066917dc42..84008d4530 100644 --- a/src/main/java/net/minecraftforge/registries/GameData.java +++ b/src/main/java/net/minecraftforge/registries/GameData.java @@ -71,7 +71,6 @@ import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.event.RegistryEvent.MissingMappings; import net.minecraftforge.fml.LifecycleEventProvider; import net.minecraftforge.fml.ModLoadingContext; -import net.minecraftforge.fml.StartupQuery; import net.minecraftforge.fml.common.EnhancedRuntimeException; import net.minecraftforge.fml.common.thread.EffectiveSide; import net.minecraftforge.fml.event.lifecycle.FMLModIdMappingEvent; @@ -647,15 +646,6 @@ public class GameData for (ResourceLocation s : missingRegs) text.append(s).append("\n"); - - boolean confirmed = StartupQuery.builder() - .header(header) - .text(text.toString()) - .action("Continue anyway?") - .confirm(); - - if (!confirmed) - StartupQuery.abort(); } } @@ -745,14 +735,6 @@ public class GameData entries.forEach(rl -> buf.append(" ").append(rl).append("\n")); buf.append("\n"); }); - - boolean confirmed = StartupQuery.builder() - .header(header) - .text(buf.toString()) - .action("Remove entries and continue?") - .confirm(); - if (!confirmed) - StartupQuery.abort(); } if (!defaulted.isEmpty()) diff --git a/src/main/java/net/minecraftforge/server/console/TerminalHandler.java b/src/main/java/net/minecraftforge/server/console/TerminalHandler.java index 5d84d3cd4e..c0b291764e 100644 --- a/src/main/java/net/minecraftforge/server/console/TerminalHandler.java +++ b/src/main/java/net/minecraftforge/server/console/TerminalHandler.java @@ -20,7 +20,6 @@ package net.minecraftforge.server.console; import net.minecraft.server.dedicated.DedicatedServer; -import net.minecraftforge.fml.StartupQuery; import net.minecrell.terminalconsole.TerminalConsoleAppender; import org.jline.reader.EndOfFileException; import org.jline.reader.LineReader;