Paper Plugins

Co-authored-by: Micah Rao <micah.s.rao@gmail.com>
This commit is contained in:
Owen1212055
2022-07-06 23:00:31 -04:00
parent 329dfdabdc
commit 216388dfdf
103 changed files with 7450 additions and 42 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/core/registries/BuiltInRegistries.java
+++ b/net/minecraft/core/registries/BuiltInRegistries.java
@@ -325,7 +325,7 @@
@@ -325,12 +325,18 @@
Bootstrap.checkBootstrapCalled(() -> "registry " + key.location());
ResourceLocation resourceLocation = key.location();
LOADERS.put(resourceLocation, () -> initializer.run(registry));
@@ -9,3 +9,14 @@
return registry;
}
public static void bootStrap() {
+ // Paper start
+ bootStrap(() -> {});
+ }
+ public static void bootStrap(Runnable runnable) {
+ // Paper end
createContents();
+ runnable.run(); // Paper
freeze();
validate(REGISTRY);
}

View File

@@ -20,7 +20,7 @@
public class Bootstrap {
public static final PrintStream STDOUT = System.out;
@@ -42,6 +46,23 @@
@@ -42,9 +46,27 @@
public static void bootStrap() {
if (!Bootstrap.isBootstrapped) {
@@ -44,7 +44,20 @@
Bootstrap.isBootstrapped = true;
Instant instant = Instant.now();
@@ -61,6 +82,69 @@
+ io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler.enterBootstrappers(); // Paper - Entrypoint for bootstrapping
if (BuiltInRegistries.REGISTRY.keySet().isEmpty()) {
throw new IllegalStateException("Unable to load registries");
} else {
@@ -56,11 +78,77 @@
EntitySelectorOptions.bootStrap();
DispenseItemBehavior.bootStrap();
CauldronInteraction.bootStrap();
- BuiltInRegistries.bootStrap();
+ // Paper start
+ BuiltInRegistries.bootStrap(() -> {
+ });
+ // Paper end
CreativeModeTabs.validate();
Bootstrap.wrapStreams();
Bootstrap.bootstrapDuration.set(Duration.between(instant, Instant.now()).toMillis());
}

View File

@@ -43,7 +43,7 @@
OptionParser optionparser = new OptionParser();
OptionSpec<Void> optionspec = optionparser.accepts("nogui");
OptionSpec<Void> optionspec1 = optionparser.accepts("initSettings", "Initializes 'server.properties' and 'eula.txt', then quits");
@@ -90,21 +100,24 @@
@@ -90,50 +100,82 @@
OptionSpec<String> optionspec15 = optionparser.nonOptions();
try {
@@ -71,7 +71,8 @@
JvmProfiler.INSTANCE.start(Environment.SERVER);
}
@@ -112,28 +125,56 @@
+ io.papermc.paper.plugin.PluginInitializerManager.load(optionset); // Paper
Bootstrap.bootStrap();
Bootstrap.validate();
Util.startTimerHackThread();
Path path1 = Paths.get("server.properties");
@@ -135,7 +136,7 @@
Dynamic dynamic;
if (convertable_conversionsession.hasWorldData()) {
@@ -174,13 +215,31 @@
@@ -174,13 +216,31 @@
}
Dynamic<?> dynamic1 = dynamic;
@@ -168,7 +169,7 @@
WorldStem worldstem;
@@ -189,6 +248,7 @@
@@ -189,6 +249,7 @@
worldstem = (WorldStem) Util.blockUntilDone((executor) -> {
return WorldLoader.load(worldloader_c, (worldloader_a) -> {
@@ -176,7 +177,7 @@
Registry<LevelStem> iregistry = worldloader_a.datapackDimensions().lookupOrThrow(Registries.LEVEL_STEM);
if (dynamic1 != null) {
@@ -201,7 +261,7 @@
@@ -201,7 +262,7 @@
WorldOptions worldoptions;
WorldDimensions worlddimensions;
@@ -185,7 +186,7 @@
worldsettings = MinecraftServer.DEMO_SETTINGS;
worldoptions = WorldOptions.DEMO_OPTIONS;
worlddimensions = WorldPresets.createNormalWorldDimensions(worldloader_a.datapackWorldgen());
@@ -209,7 +269,7 @@
@@ -209,7 +270,7 @@
DedicatedServerProperties dedicatedserverproperties = dedicatedserversettings.getProperties();
worldsettings = new LevelSettings(dedicatedserverproperties.levelName, dedicatedserverproperties.gamemode, dedicatedserverproperties.hardcore, dedicatedserverproperties.difficulty, false, new GameRules(worldloader_a.dataConfiguration().enabledFeatures()), worldloader_a.dataConfiguration());
@@ -194,7 +195,7 @@
worlddimensions = dedicatedserverproperties.createDimensions(worldloader_a.datapackWorldgen());
}
@@ -225,32 +285,44 @@
@@ -225,32 +286,44 @@
return;
}
@@ -244,7 +245,7 @@
Thread thread = new Thread("Server Shutdown Thread") {
public void run() {
dedicatedserver.halt(true);
@@ -259,6 +331,7 @@
@@ -259,6 +332,7 @@
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(Main.LOGGER));
Runtime.getRuntime().addShutdownHook(thread);
@@ -252,7 +253,7 @@
} catch (Exception exception1) {
Main.LOGGER.error(LogUtils.FATAL_MARKER, "Failed to start the minecraft server", exception1);
}
@@ -295,7 +368,7 @@
@@ -295,7 +369,7 @@
}
public static void forceUpgrade(LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, boolean eraseCache, BooleanSupplier continueCheck, RegistryAccess dynamicRegistryManager, boolean recreateRegionFiles) {