Dieser Commit ist enthalten in:
Chaoscaot 2024-08-11 18:24:35 +02:00
Ursprung 191d74a113
Commit 678af5b9fa
8 geänderte Dateien mit 9870 neuen und 2581 gelöschten Zeilen

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Initialisation improvements
diff --git a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
index 13da387d3b59bc67c0d73e3fbd3a4034b1281527..9a1b7946a257e1319eba99d6ef7fd860bdd3b0da 100644
index 7e4f7cb2afbc145e532285c793573ad107bc3033..d5931454d3022b2e55e2e0f4f66edd470d24a3ee 100644
--- a/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
+++ b/src/main/java/org/bukkit/plugin/java/PluginClassLoader.java
@@ -191,47 +191,7 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm
@@ -205,47 +205,7 @@ public final class PluginClassLoader extends URLClassLoader implements io.paperm
Class<?> result = classes.get(name);
if (result == null) {

Datei anzeigen

@ -1,70 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Lixfel <agga-games@gmx.de>
Date: Thu, 13 Apr 2023 10:28:53 +0200
Subject: [PATCH] Tick freeze
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 18aac3da3c88f33b1a71a5920a8daa27e9723913..678f6a99bf6856fcfda67f628b2be28e7b727043 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -766,6 +766,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
public void tick(BooleanSupplier shouldKeepTicking) {
+ if(!freezed) {
// Paper start - optimise checkDespawn
this.playersAffectingSpawning.clear();
for (ServerPlayer player : this.players) {
@@ -774,9 +775,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}
// Paper end - optimise checkDespawn
+ } // freezed
ProfilerFiller gameprofilerfiller = this.getProfiler();
this.handlingTick = true;
+ if(!freezed) {
gameprofilerfiller.push("world border");
this.getWorldBorder().tick();
gameprofilerfiller.popPush("weather");
@@ -822,14 +825,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.timings.raids.startTiming(); // Paper - timings
this.raids.tick();
this.timings.raids.stopTiming(); // Paper - timings
+ } // freezed
gameprofilerfiller.popPush("chunkSource");
this.timings.chunkProviderTick.startTiming(); // Paper - timings
this.getChunkSource().tick(shouldKeepTicking, true);
this.timings.chunkProviderTick.stopTiming(); // Paper - timings
+ if(!freezed) {
gameprofilerfiller.popPush("blockEvents");
timings.doSounds.startTiming(); // Spigot
this.runBlockEvents();
timings.doSounds.stopTiming(); // Spigot
+ } // freezed
this.handlingTick = false;
gameprofilerfiller.pop();
boolean flag = true || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players
@@ -838,7 +844,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
this.resetEmptyTime();
}
- if (flag || this.emptyTime++ < 300) {
+ if (!freezed && (flag || this.emptyTime++ < 300)) {
gameprofilerfiller.push("entities");
timings.tickEntities.startTiming(); // Spigot
if (this.dragonFight != null) {
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 147d802d9207e358fdb2d1c7806fc2f634dcfd98..ec8c544d9448e33aa51ac0ee1da952a3a88c929a 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -184,6 +184,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public final Map<Explosion.CacheKey, Float> explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions
public java.util.ArrayDeque<net.minecraft.world.level.block.RedstoneTorchBlock.Toggle> redstoneUpdateInfos; // Paper - Move from Map in BlockRedstoneTorch to here
+ public boolean freezed = false;
+
// Paper start - fix and optimise world upgrading
// copied from below
public static ResourceKey<DimensionType> getDimensionKey(DimensionType manager) {

Datei anzeigen

@ -1,31 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Lixfel <agga-games@gmx.de>
Date: Tue, 9 May 2023 11:43:19 +0200
Subject: [PATCH] Make TPSWarp great again
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index d031a6392f02b50392d7aa030b5de28b3c7897de..dc8f95ab94c907e7b006ca440fa4797463e6f601 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -42,10 +42,7 @@ import java.util.Map.Entry;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Executor;
-import java.util.concurrent.RejectedExecutionException;
+import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.BooleanSupplier;
import java.util.function.Consumer;
@@ -1273,7 +1270,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
private boolean canSleepForTickNoOversleep() {
- return this.forceTicks || this.runningTask() || Util.getMillis() < this.nextTickTime;
+ return this.forceTicks || this.runningTask() || Util.timeSource.getAsLong()/1000000 < this.nextTickTime;
}
// Paper end

Dateidiff unterdrückt, weil mindestens eine Zeile zu lang ist

Datei anzeigen

@ -1,115 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Lixfel <agga-games@gmx.de>
Date: Fri, 23 Jun 2023 15:59:15 +0200
Subject: [PATCH] Optimize explosion with cache
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index 8f97c9df726ac20cfce7bdddd5dd4f8c5aa76c35..0b9211837b0353a09b3202055e27a144e9d7ccfa 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -7,6 +7,7 @@ import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import it.unimi.dsi.fastutil.objects.ObjectListIterator;
import java.util.List;
import java.util.Map;
+import java.util.HashMap;
import java.util.Optional;
import java.util.Set;
import javax.annotation.Nullable;
@@ -135,6 +136,33 @@ public class Explosion {
}
}
+ private class BlockCache {
+ private final BlockState state;
+ private final float blastResistance;
+ private boolean destroyed;
+
+ private BlockCache(BlockPos blockPos) {
+ state = level.getBlockState(blockPos);
+ if (!state.isDestroyable()) {
+ blastResistance = 3_600_000.0f;
+ return;
+ }
+
+ if (!level.isInWorldBounds(blockPos)) {
+ blastResistance = 3_600_000.0f;
+ return;
+ }
+
+ Optional<Float> optional = damageCalculator.getBlockExplosionResistance(Explosion.this, level, blockPos, state, state.getFluidState());
+ blastResistance = optional.map(resistance -> (resistance + 0.3F) * 0.3F).orElse(0.0f);
+ }
+
+ private BlockCache(BlockState state, float blastResistance) {
+ this.state = state;
+ this.blastResistance = blastResistance;
+ }
+ }
+
public void explode() {
// CraftBukkit start
if (this.radius < 0.1F) {
@@ -142,12 +170,12 @@ public class Explosion {
}
// CraftBukkit end
this.level.gameEvent(this.source, GameEvent.EXPLODE, new Vec3(this.x, this.y, this.z));
- Set<BlockPos> set = Sets.newHashSet();
boolean flag = true;
int i;
int j;
+ Map<BlockPos, BlockCache> cache = new HashMap<>();
for (int k = 0; k < 16; ++k) {
for (i = 0; i < 16; ++i) {
for (j = 0; j < 16; ++j) {
@@ -167,28 +195,18 @@ public class Explosion {
for (float f1 = 0.3F; f > 0.0F; f -= 0.22500001F) {
BlockPos blockposition = BlockPos.containing(d4, d5, d6);
- BlockState iblockdata = this.level.getBlockState(blockposition);
- if (!iblockdata.isDestroyable()) continue; // Paper
- FluidState fluid = iblockdata.getFluidState(); // Paper
-
- if (!this.level.isInWorldBounds(blockposition)) {
- break;
- }
+ BlockCache cacheEntry = cache.computeIfAbsent(blockposition, BlockCache::new);
- Optional<Float> optional = this.damageCalculator.getBlockExplosionResistance(this, this.level, blockposition, iblockdata, fluid);
+ f -= cacheEntry.blastResistance;
- if (optional.isPresent()) {
- f -= ((Float) optional.get() + 0.3F) * 0.3F;
- }
-
- if (f > 0.0F && this.damageCalculator.shouldBlockExplode(this, this.level, blockposition, iblockdata, f)) {
- set.add(blockposition);
+ if (f > 0.0F && this.damageCalculator.shouldBlockExplode(this, this.level, blockposition, cacheEntry.state, f)) {
+ cacheEntry.destroyed = true;
// Paper start - prevent headless pistons from forming
- if (!io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowHeadlessPistons && iblockdata.getBlock() == Blocks.MOVING_PISTON) {
+ if (!io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowHeadlessPistons && cacheEntry.state.getBlock() == Blocks.MOVING_PISTON) {
BlockEntity extension = this.level.getBlockEntity(blockposition);
if (extension instanceof net.minecraft.world.level.block.piston.PistonMovingBlockEntity blockEntity && blockEntity.isSourcePiston()) {
- net.minecraft.core.Direction direction = iblockdata.getValue(net.minecraft.world.level.block.piston.PistonHeadBlock.FACING);
- set.add(blockposition.relative(direction.getOpposite()));
+ net.minecraft.core.Direction direction = cacheEntry.state.getValue(net.minecraft.world.level.block.piston.PistonHeadBlock.FACING);
+ cache.computeIfAbsent(blockposition.relative(direction.getOpposite()), BlockCache::new).destroyed = true;
}
}
// Paper end
@@ -203,7 +221,11 @@ public class Explosion {
}
}
- this.toBlow.addAll(set);
+ for(Map.Entry<BlockPos, BlockCache> entry : cache.entrySet()) {
+ if(entry.getValue().destroyed)
+ toBlow.add(entry.getKey());
+ }
+
float f2 = this.radius * 2.0F;
i = Mth.floor(this.x - (double) f2 - 1.0D);

Datei anzeigen

@ -1,36 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Lixfel <agga-games@gmx.de>
Date: Fri, 25 Aug 2023 19:16:30 +0200
Subject: [PATCH] Fix player chunk loader initialization
diff --git a/src/main/java/io/papermc/paper/chunk/system/RegionizedPlayerChunkLoader.java b/src/main/java/io/papermc/paper/chunk/system/RegionizedPlayerChunkLoader.java
index 924539d4ac50c70178ba220424ffacd6ff277c8b..7af3a6c512186ffee49d6677f91d9b337c5634c0 100644
--- a/src/main/java/io/papermc/paper/chunk/system/RegionizedPlayerChunkLoader.java
+++ b/src/main/java/io/papermc/paper/chunk/system/RegionizedPlayerChunkLoader.java
@@ -246,6 +246,16 @@ public class RegionizedPlayerChunkLoader {
}
private static long[] generateBFSOrder(final int radius) {
+ final int side = radius*2 + 1;
+ long[] array = new long[side*side];
+ int i = 0;
+ for(int z = -radius; z <= radius; z++) {
+ for(int x = -radius; x <= radius; x++) {
+ array[i++] = CoordinateUtils.getChunkKey(x, z);
+ }
+ }
+ return array;
+ /*
final LongArrayList chunks = new LongArrayList();
final LongArrayFIFOQueue queue = new LongArrayFIFOQueue();
final LongOpenHashSet seen = new LongOpenHashSet();
@@ -371,7 +381,7 @@ public class RegionizedPlayerChunkLoader {
ret.addAll(dist);
}
- return ret.toLongArray();
+ return ret.toLongArray();*/
}
public static final class PlayerChunkLoaderData {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Initialisation improvements
diff --git a/src/main/java/com/destroystokyo/paper/VersionHistoryManager.java b/src/main/java/com/destroystokyo/paper/VersionHistoryManager.java
index aac3f66cb23d260729c2a48d8710a9de2346aa22..e82dead35af828cefd8c72f52e1270e6988d52d3 100644
index 660b2ec6b63a4ceffee44ab11f54dfa7c0d0996f..81902d28ac96cebb98d66bf5a4ff4237bf00d181 100644
--- a/src/main/java/com/destroystokyo/paper/VersionHistoryManager.java
+++ b/src/main/java/com/destroystokyo/paper/VersionHistoryManager.java
@@ -84,7 +84,7 @@ public enum VersionHistoryManager {
@@ -92,7 +92,7 @@ public enum VersionHistoryManager {
)) {
gson.toJson(currentData, writer);
} catch (final IOException e) {
@ -18,10 +18,10 @@ index aac3f66cb23d260729c2a48d8710a9de2346aa22..e82dead35af828cefd8c72f52e1270e6
}
diff --git a/src/main/java/io/papermc/paper/configuration/Configurations.java b/src/main/java/io/papermc/paper/configuration/Configurations.java
index 9ef6712c70fcd8912a79f3f61e351aac09572cf3..40c716de742c48f6d4911fae1756f9bfefda7442 100644
index 87e5f614ba988547a827486740db217e28585773..c83eae306debfe34fb6383cb83a3dad0f74431a4 100644
--- a/src/main/java/io/papermc/paper/configuration/Configurations.java
+++ b/src/main/java/io/papermc/paper/configuration/Configurations.java
@@ -106,7 +106,7 @@ public abstract class Configurations<G, W> {
@@ -114,7 +114,7 @@ public abstract class Configurations<G, W> {
loader.save(node);
} catch (ConfigurateException ex) {
if (ex.getCause() instanceof AccessDeniedException) {
@ -31,10 +31,10 @@ index 9ef6712c70fcd8912a79f3f61e351aac09572cf3..40c716de742c48f6d4911fae1756f9bf
}
}
diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
index e471960e0443392f6f54732b052a4debf2a8fd97..79437b2dab2c21753281cee8c14ec2182d23e92e 100644
index 783eac6e458c6f1a0584301fb84a2fe341868f34..ec2194d292f79ea66a2b85835189f270cb727f9f 100644
--- a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
+++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
@@ -435,8 +435,6 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
@@ -459,8 +459,6 @@ public class PaperConfigurations extends Configurations<GlobalConfiguration, Wor
// Symlinks are not correctly checked in createDirectories
static void createDirectoriesSymlinkAware(Path path) throws IOException {
@ -45,10 +45,10 @@ index e471960e0443392f6f54732b052a4debf2a8fd97..79437b2dab2c21753281cee8c14ec218
}
}
diff --git a/src/main/java/io/papermc/paper/util/ObfHelper.java b/src/main/java/io/papermc/paper/util/ObfHelper.java
index b8b17d046f836c8652ab094db00ab1af84971b2c..e5790e871c46f9d2b92237ed378ecea5a7439e50 100644
index 6067be951c4c52c4b1da51efc01436b2c90ea3bf..da32dbdb0e78a30e812c87065ebdc74a6623d81e 100644
--- a/src/main/java/io/papermc/paper/util/ObfHelper.java
+++ b/src/main/java/io/papermc/paper/util/ObfHelper.java
@@ -29,7 +29,7 @@ public enum ObfHelper {
@@ -21,7 +21,7 @@ public enum ObfHelper {
private final @Nullable Map<String, ClassMapping> mappingsByMojangName;
ObfHelper() {
@ -58,21 +58,21 @@ index b8b17d046f836c8652ab094db00ab1af84971b2c..e5790e871c46f9d2b92237ed378ecea5
this.mappingsByObfName = maps.stream().collect(Collectors.toUnmodifiableMap(ClassMapping::obfName, map -> map));
this.mappingsByMojangName = maps.stream().collect(Collectors.toUnmodifiableMap(ClassMapping::mojangName, map -> map));
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index 80c2c8d565f03ae0ea24fbdecdbe2bc5b9aa4b82..6d7c2ccf4576f0ce07bc05a816336adb5221a4c6 100644
index 1d1e76de60e40224f5cb81893f9ee50fe987badb..1c0db35868d76f873c187a6e9191dfe15b80b58f 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -141,63 +141,63 @@ public class Commands {
@@ -156,65 +156,63 @@ public class Commands {
public Commands(Commands.CommandSelection environment, CommandBuildContext commandRegistryAccess) {
this(); // CraftBukkit
// Paper
- AdvancementCommands.register(this.dispatcher);
- AttributeCommand.register(this.dispatcher, commandRegistryAccess);
- ExecuteCommand.register(this.dispatcher, commandRegistryAccess);
- BossBarCommands.register(this.dispatcher);
- BossBarCommands.register(this.dispatcher, commandRegistryAccess);
+ //AdvancementCommands.register(this.dispatcher);
+ //AttributeCommand.register(this.dispatcher, commandRegistryAccess);
+ //ExecuteCommand.register(this.dispatcher, commandRegistryAccess);
+ //BossBarCommands.register(this.dispatcher);
+ //BossBarCommands.register(this.dispatcher, commandRegistryAccess);
ClearInventoryCommands.register(this.dispatcher, commandRegistryAccess);
- CloneCommands.register(this.dispatcher, commandRegistryAccess);
- DamageCommand.register(this.dispatcher, commandRegistryAccess);
@ -110,24 +110,25 @@ index 80c2c8d565f03ae0ea24fbdecdbe2bc5b9aa4b82..6d7c2ccf4576f0ce07bc05a816336adb
+ //ItemCommands.register(this.dispatcher, commandRegistryAccess);
KickCommand.register(this.dispatcher);
KillCommand.register(this.dispatcher);
ListPlayersCommand.register(this.dispatcher);
- ListPlayersCommand.register(this.dispatcher);
- LocateCommand.register(this.dispatcher, commandRegistryAccess);
- LootCommand.register(this.dispatcher, commandRegistryAccess);
- MsgCommand.register(this.dispatcher);
- ParticleCommand.register(this.dispatcher, commandRegistryAccess);
- PlaceCommand.register(this.dispatcher);
- PlaySoundCommand.register(this.dispatcher);
- RandomCommand.register(this.dispatcher);
- ReloadCommand.register(this.dispatcher);
- RecipeCommand.register(this.dispatcher);
- ReturnCommand.register(this.dispatcher);
- RideCommand.register(this.dispatcher);
- SayCommand.register(this.dispatcher);
- ScheduleCommand.register(this.dispatcher);
- ScoreboardCommand.register(this.dispatcher);
- ScoreboardCommand.register(this.dispatcher, commandRegistryAccess);
- SeedCommand.register(this.dispatcher, environment != Commands.CommandSelection.INTEGRATED);
- SetBlockCommand.register(this.dispatcher, commandRegistryAccess);
- SetSpawnCommand.register(this.dispatcher);
+ //LocateCommand.register(this.dispatcher, commandRegistryAccess);
+ ListPlayersCommand.register(this.dispatcher); //LocateCommand.register(this.dispatcher, commandRegistryAccess);
+ //LootCommand.register(this.dispatcher, commandRegistryAccess);
+ //MsgCommand.register(this.dispatcher);
+ //ParticleCommand.register(this.dispatcher, commandRegistryAccess);
@ -151,23 +152,24 @@ index 80c2c8d565f03ae0ea24fbdecdbe2bc5b9aa4b82..6d7c2ccf4576f0ce07bc05a816336adb
+ //StopSoundCommand.register(this.dispatcher);
SummonCommand.register(this.dispatcher, commandRegistryAccess);
- TagCommand.register(this.dispatcher);
- TeamCommand.register(this.dispatcher);
- TeamCommand.register(this.dispatcher, commandRegistryAccess);
- TeamMsgCommand.register(this.dispatcher);
+ //TagCommand.register(this.dispatcher);
+ //TeamCommand.register(this.dispatcher);
+ //TeamCommand.register(this.dispatcher, commandRegistryAccess);
+ //TeamMsgCommand.register(this.dispatcher);
TeleportCommand.register(this.dispatcher);
- TellRawCommand.register(this.dispatcher);
+ //TellRawCommand.register(this.dispatcher);
- TellRawCommand.register(this.dispatcher, commandRegistryAccess);
+ //TellRawCommand.register(this.dispatcher, commandRegistryAccess);
TickCommand.register(this.dispatcher);
TimeCommand.register(this.dispatcher);
- TitleCommand.register(this.dispatcher);
- TitleCommand.register(this.dispatcher, commandRegistryAccess);
- TriggerCommand.register(this.dispatcher);
+ //TitleCommand.register(this.dispatcher);
+ //TitleCommand.register(this.dispatcher, commandRegistryAccess);
+ //TriggerCommand.register(this.dispatcher);
WeatherCommand.register(this.dispatcher);
WorldBorderCommand.register(this.dispatcher);
if (JvmProfiler.INSTANCE.isAvailable()) {
@@ -210,18 +210,18 @@ public class Commands {
@@ -235,18 +233,18 @@ public class Commands {
}
if (environment.includeDedicated) {
@ -193,129 +195,13 @@ index 80c2c8d565f03ae0ea24fbdecdbe2bc5b9aa4b82..6d7c2ccf4576f0ce07bc05a816336adb
- SetPlayerIdleTimeoutCommand.register(this.dispatcher);
+ //SetPlayerIdleTimeoutCommand.register(this.dispatcher);
StopCommand.register(this.dispatcher);
TransferCommand.register(this.dispatcher);
WhitelistCommand.register(this.dispatcher);
}
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
index dae36c6452ccd57a436dd918547b64d59957ab0a..1c21d56cc80c24d1c9934de9785df926d7dd8475 100644
--- a/src/main/java/net/minecraft/server/Main.java
+++ b/src/main/java/net/minecraft/server/Main.java
@@ -15,8 +15,11 @@ import java.net.Proxy;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
+import java.security.KeyPair;
import java.util.Optional;
import java.util.UUID;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
import java.util.function.BooleanSupplier;
import io.papermc.paper.world.ThreadedWorldUpgrader;
import joptsimple.NonOptionArgumentSpec;
@@ -45,6 +48,7 @@ import net.minecraft.server.level.progress.LoggerChunkProgressListener;
import net.minecraft.server.packs.PackType;
import net.minecraft.server.packs.repository.PackRepository;
import net.minecraft.server.packs.repository.ServerPacksSource;
+import net.minecraft.util.Crypt;
import net.minecraft.util.Mth;
import net.minecraft.util.datafix.DataFixers;
import net.minecraft.util.profiling.jfr.Environment;
@@ -76,12 +80,18 @@ import org.bukkit.configuration.file.YamlConfiguration;
public class Main {
private static final Logger LOGGER = LogUtils.getLogger();
+ public static Future<KeyPair> keyPair;
+ public static Future<?> paperConfig;
public Main() {}
@DontObfuscate
public static void main(final OptionSet optionset) { // CraftBukkit - replaces main(String[] astring)
SharedConstants.tryDetectVersion();
+ ExecutorService executorService = Util.backgroundExecutor();
+ executorService.submit(() -> Class.forName("net.minecraft.util.datafix.DataConverterRegistry"));
+ executorService.submit(() -> Class.forName("org.bukkit.Material"));
+ keyPair = executorService.submit(Crypt::generateKeyPair);
/* CraftBukkit start - Replace everything
OptionParser optionparser = new OptionParser();
OptionSpec<Void> optionspec = optionparser.accepts("nogui");
@@ -118,7 +128,6 @@ public class Main {
Main.writePidFile(path);
}
- CrashReport.preload();
if (optionset.has("jfrProfile")) { // CraftBukkit
JvmProfiler.INSTANCE.start(Environment.SERVER);
}
@@ -126,7 +135,7 @@ public class Main {
io.papermc.paper.plugin.PluginInitializerManager.load(optionset); // Paper
Bootstrap.bootStrap();
Bootstrap.validate();
- Util.startTimerHackThread();
+ Thread.setDefaultUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(LOGGER));
Path path1 = Paths.get("server.properties");
DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(optionset); // CraftBukkit - CLI argument support
@@ -194,6 +203,10 @@ public class Main {
}
// Paper end - fix SPIGOT-5824
Services services = Services.create(new com.destroystokyo.paper.profile.PaperAuthenticationService(Proxy.NO_PROXY), file, userCacheFile, optionset); // Paper
+ paperConfig = executorService.submit(() -> {
+ services.paperConfigurations().initializeGlobalConfiguration();
+ return null;
+ });
// CraftBukkit start
String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName);
LevelStorageSource convertable = LevelStorageSource.createDefault(file.toPath());
@@ -220,7 +233,7 @@ public class Main {
PackRepository resourcepackrepository = ServerPacksSource.createPackRepository(convertable_conversionsession.getLevelPath(LevelResource.DATAPACK_DIR));
// CraftBukkit start
- File bukkitDataPackFolder = new File(convertable_conversionsession.getLevelPath(LevelResource.DATAPACK_DIR).toFile(), "bukkit");
+ /*File bukkitDataPackFolder = new File(convertable_conversionsession.getLevelPath(LevelResource.DATAPACK_DIR).toFile(), "bukkit");
if (!bukkitDataPackFolder.exists()) {
bukkitDataPackFolder.mkdirs();
}
@@ -234,7 +247,7 @@ public class Main {
+ "}\n", mcMeta, com.google.common.base.Charsets.UTF_8);
} catch (java.io.IOException ex) {
throw new RuntimeException("Could not initialize Bukkit datapack", ex);
- }
+ }*/
AtomicReference<WorldLoader.DataLoadContext> worldLoader = new AtomicReference<>();
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 435f5ee3388f5da93df938c43ea2578f7d586407..638086445b4607dd99591ef8a861237c3b83667d 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -43,6 +43,7 @@ import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.atomic.AtomicReference;
@@ -1770,9 +1771,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
MinecraftServer.LOGGER.info("Generating keypair");
try {
- this.keyPair = Crypt.generateKeyPair();
- } catch (CryptException cryptographyexception) {
- throw new IllegalStateException("Failed to generate key pair", cryptographyexception);
+ this.keyPair = net.minecraft.server.Main.keyPair.get();
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ } catch (ExecutionException e) {
+ throw new IllegalStateException(e);
}
}
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 9f422cbeaa52b3e6a0a27af4f8ad4ddb7808483f..4331b09596cd0a83dd2f8ea325ec66a7a57a9f9c 100644
index dd56c8e041116ef3602a9f89c998c8208ab89b51..d3dbc896d611f0f719bb257c01789e1fdae751b0 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -17,6 +17,7 @@ import java.util.Collections;
@@ -18,6 +18,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
@ -323,25 +209,10 @@ index 9f422cbeaa52b3e6a0a27af4f8ad4ddb7808483f..4331b09596cd0a83dd2f8ea325ec66a7
import java.util.function.BooleanSupplier;
import javax.annotation.Nullable;
import net.minecraft.DefaultUncaughtExceptionHandler;
@@ -26,11 +27,7 @@ import net.minecraft.SystemReport;
import net.minecraft.Util;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.core.BlockPos;
-import net.minecraft.server.ConsoleInput;
-import net.minecraft.server.MinecraftServer;
-import net.minecraft.server.ServerInterface;
-import net.minecraft.server.Services;
-import net.minecraft.server.WorldStem;
+import net.minecraft.server.*;
import net.minecraft.server.gui.MinecraftServerGui;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
@@ -206,8 +203,14 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -223,6 +224,13 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
// Spigot end
// Paper start
io.papermc.paper.util.ObfHelper.INSTANCE.getClass(); // Paper - load mappings for stacktrace deobf and etc.
- paperConfigurations.initializeGlobalConfiguration();
- paperConfigurations.initializeWorldDefaultsConfiguration();
// Paper start - initialize global and world-defaults configuration
+ try {
+ Main.paperConfig.get();
+ } catch (InterruptedException e) {
@ -349,15 +220,14 @@ index 9f422cbeaa52b3e6a0a27af4f8ad4ddb7808483f..4331b09596cd0a83dd2f8ea325ec66a7
+ } catch (ExecutionException e) {
+ throw new IOException(e);
+ }
+ services.paperConfigurations().initializeWorldDefaultsConfiguration();
// Paper start - moved up to right after PlayerList creation but before file load/save
if (this.convertOldUsers()) {
this.getProfileCache().save(false); // Paper
this.paperConfigurations.initializeGlobalConfiguration(this.registryAccess());
this.paperConfigurations.initializeWorldDefaultsConfiguration(this.registryAccess());
// Paper end - initialize global and world-defaults configuration
diff --git a/src/main/java/net/minecraft/server/players/StoredUserList.java b/src/main/java/net/minecraft/server/players/StoredUserList.java
index 9e8112fbc40a1d89c0f73ea4452e0fa1bb459bf4..140fda390af47b78eed26c76631da598b8770107 100644
index c038da20b76c0b7b1c18471b20be01e849d29f3a..f5611bf250aaa2851ca8873291c7f4b6c3771281 100644
--- a/src/main/java/net/minecraft/server/players/StoredUserList.java
+++ b/src/main/java/net/minecraft/server/players/StoredUserList.java
@@ -10,10 +10,8 @@ import com.google.gson.JsonArray;
@@ -9,10 +9,8 @@ import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.mojang.logging.LogUtils;
@ -367,10 +237,10 @@ index 9e8112fbc40a1d89c0f73ea4452e0fa1bb459bf4..140fda390af47b78eed26c76631da598
-import java.io.IOException;
+
+import java.io.*;
import java.lang.reflect.ParameterizedType; // Paper
import java.lang.reflect.Type; // Paper
import java.nio.charset.StandardCharsets;
@@ -154,7 +152,12 @@ public abstract class StoredUserList<K, V extends StoredUserEntry<K>> {
import java.util.Collection;
import java.util.Iterator;
@@ -114,7 +112,12 @@ public abstract class StoredUserList<K, V extends StoredUserEntry<K>> {
Objects.requireNonNull(jsonarray);
stream.forEach(jsonarray::add);
@ -383,12 +253,12 @@ index 9e8112fbc40a1d89c0f73ea4452e0fa1bb459bf4..140fda390af47b78eed26c76631da598
+ }
try {
StoredUserList.GSON.toJson(jsonarray, bufferedwriter);
StoredUserList.GSON.toJson(jsonarray, StoredUserList.GSON.newJsonWriter(bufferedwriter));
diff --git a/src/main/java/net/minecraft/world/level/biome/Climate.java b/src/main/java/net/minecraft/world/level/biome/Climate.java
index 5f99034ed1b0f6e562f9e5b383896198f03f369b..90b51c72fbeacf427a2a443ec77e1a699a72b0ff 100644
index f06a35024af284addf41dfe160849e8e5e15e822..466e4d8f2ce9ce672c498d5e4080ea099995721b 100644
--- a/src/main/java/net/minecraft/world/level/biome/Climate.java
+++ b/src/main/java/net/minecraft/world/level/biome/Climate.java
@@ -203,7 +203,15 @@ public class Climate {
@@ -258,7 +258,15 @@ public class Climate {
this.root = firstNode;
}
@ -404,13 +274,13 @@ index 5f99034ed1b0f6e562f9e5b383896198f03f369b..90b51c72fbeacf427a2a443ec77e1a69
if (entries.isEmpty()) {
throw new IllegalArgumentException("Need at least one value to build the search tree.");
} else {
@@ -211,10 +219,10 @@ public class Climate {
@@ -266,10 +274,10 @@ public class Climate {
if (i != 7) {
throw new IllegalStateException("Expecting parameter space to be 7, got " + i);
} else {
- List<Climate.RTree.Leaf<T>> list = entries.stream().map((entry) -> {
- return new Climate.RTree.Leaf(entry.getFirst(), entry.getSecond());
- }).collect(Collectors.toCollection(ArrayList::new));
- List<Climate.RTree.Leaf<T>> list = entries.stream()
- .map(entry -> new Climate.RTree.Leaf(entry.getFirst(), entry.getSecond()))
- .collect(Collectors.toCollection(ArrayList::new));
- return new Climate.RTree<>(build(i, list));
+ List<Leaf<T>> list = entries.stream().map(entry -> new Leaf<>(entry.getFirst(), entry.getSecond())).collect(Collectors.toCollection(ArrayList::new));
+ RTree<T> tree = new RTree<>(build(i, list));
@ -420,28 +290,20 @@ index 5f99034ed1b0f6e562f9e5b383896198f03f369b..90b51c72fbeacf427a2a443ec77e1a69
}
}
diff --git a/src/main/java/net/minecraft/world/level/block/Blocks.java b/src/main/java/net/minecraft/world/level/block/Blocks.java
index 877035b6c6593a28f475b9c5bcd7727e3fcdb802..e8f4cc6b23588287d40b39c7f6ca638eae17dbbc 100644
index 223259e7a09ada681b6181c898f6857888594f85..475cd0583e99495ca0df665da19cc382a8d5e7ea 100644
--- a/src/main/java/net/minecraft/world/level/block/Blocks.java
+++ b/src/main/java/net/minecraft/world/level/block/Blocks.java
@@ -1,6 +1,8 @@
@@ -1,7 +1,9 @@
package net.minecraft.world.level.block;
+import java.util.concurrent.ExecutorService;
import java.util.function.Function;
import java.util.function.ToIntFunction;
+import net.minecraft.Util;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Registry;
@@ -1159,7 +1161,7 @@ public class Blocks {
}
private static Boolean ocelotOrParrot(BlockState state, BlockGetter world, BlockPos pos, EntityType<?> type) {
- return (boolean)type == EntityType.OCELOT || type == EntityType.PARROT;
+ return type == EntityType.OCELOT || type == EntityType.PARROT;
}
private static BedBlock bed(DyeColor color) {
@@ -1252,7 +1254,8 @@ public class Blocks {
@@ -7797,7 +7799,8 @@ public class Blocks {
}
public static void rebuildCache() {
@ -452,10 +314,10 @@ index 877035b6c6593a28f475b9c5bcd7727e3fcdb802..e8f4cc6b23588287d40b39c7f6ca638e
static {
diff --git a/src/main/java/net/minecraft/world/level/block/WallBlock.java b/src/main/java/net/minecraft/world/level/block/WallBlock.java
index d1d0fa66aa0c3e481b6d68fe36147040a730293f..5eb144366355f354e611b83b14669ef74b8251b3 100644
index 83956032bef4d34eddb9899f0a2847e66bfd83f4..24eb3b5c805a5df9b029b4a2a98f2a3720065e5e 100644
--- a/src/main/java/net/minecraft/world/level/block/WallBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/WallBlock.java
@@ -32,8 +32,14 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
@@ -35,8 +35,14 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
public static final EnumProperty<WallSide> SOUTH_WALL = BlockStateProperties.SOUTH_WALL;
public static final EnumProperty<WallSide> WEST_WALL = BlockStateProperties.WEST_WALL;
public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED;
@ -472,16 +334,7 @@ index d1d0fa66aa0c3e481b6d68fe36147040a730293f..5eb144366355f354e611b83b14669ef7
private static final int WALL_WIDTH = 3;
private static final int WALL_HEIGHT = 14;
private static final int POST_WIDTH = 4;
@@ -49,8 +55,6 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
public WallBlock(BlockBehaviour.Properties settings) {
super(settings);
this.registerDefaultState(this.stateDefinition.any().setValue(UP, Boolean.valueOf(true)).setValue(NORTH_WALL, WallSide.NONE).setValue(EAST_WALL, WallSide.NONE).setValue(SOUTH_WALL, WallSide.NONE).setValue(WEST_WALL, WallSide.NONE).setValue(WATERLOGGED, Boolean.valueOf(false)));
- this.shapeByIndex = this.makeShapes(4.0F, 3.0F, 16.0F, 0.0F, 14.0F, 16.0F);
- this.collisionShapeByIndex = this.makeShapes(4.0F, 3.0F, 24.0F, 0.0F, 24.0F, 24.0F);
}
private static VoxelShape applyWallShape(VoxelShape base, WallSide wallShape, VoxelShape tall, VoxelShape low) {
@@ -61,7 +65,7 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
@@ -78,7 +84,7 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
}
}
@ -490,20 +343,19 @@ index d1d0fa66aa0c3e481b6d68fe36147040a730293f..5eb144366355f354e611b83b14669ef7
float l = 8.0F - f;
float m = 8.0F + f;
float n = 8.0F - g;
@@ -75,7 +79,7 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
VoxelShape voxelShape7 = Block.box((double)n, (double)i, (double)n, (double)o, (double)k, 16.0D);
VoxelShape voxelShape8 = Block.box(0.0D, (double)i, (double)n, (double)o, (double)k, (double)o);
VoxelShape voxelShape9 = Block.box((double)n, (double)i, (double)n, 16.0D, (double)k, (double)o);
- ImmutableMap.Builder<BlockState, VoxelShape> builder = ImmutableMap.builder();
+ ImmutableMap.Builder<ImmutableMap<Property<?>, Comparable<?>>, VoxelShape> builder = ImmutableMap.builder();
@@ -92,7 +98,7 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
VoxelShape voxelShape7 = Block.box((double)n, (double)i, (double)n, (double)o, (double)k, 16.0);
VoxelShape voxelShape8 = Block.box(0.0, (double)i, (double)n, (double)o, (double)k, (double)o);
VoxelShape voxelShape9 = Block.box((double)n, (double)i, (double)n, 16.0, (double)k, (double)o);
- Builder<BlockState, VoxelShape> builder = ImmutableMap.builder();
+ Builder<ImmutableMap<Property<?>, Comparable<?>>, VoxelShape> builder = ImmutableMap.builder();
for(Boolean boolean_ : UP.getPossibleValues()) {
for(WallSide wallSide : EAST_WALL.getPossibleValues()) {
@@ -91,9 +95,8 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
voxelShape10 = Shapes.or(voxelShape10, voxelShape);
}
- BlockState blockState = this.defaultBlockState().setValue(UP, boolean_).setValue(EAST_WALL, wallSide).setValue(WEST_WALL, wallSide3).setValue(NORTH_WALL, wallSide2).setValue(SOUTH_WALL, wallSide4);
for (Boolean boolean_ : UP.getPossibleValues()) {
for (WallSide wallSide : EAST_WALL.getPossibleValues()) {
@@ -114,8 +120,8 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
.setValue(WEST_WALL, wallSide3)
.setValue(NORTH_WALL, wallSide2)
.setValue(SOUTH_WALL, wallSide4);
- builder.put(blockState.setValue(WATERLOGGED, Boolean.valueOf(false)), voxelShape10);
- builder.put(blockState.setValue(WATERLOGGED, Boolean.valueOf(true)), voxelShape10);
+ builder.put(ImmutableMap.of(UP, boolean_, EAST_WALL, wallSide, WEST_WALL, wallSide3, NORTH_WALL, wallSide2, SOUTH_WALL, wallSide4, WATERLOGGED, Boolean.FALSE), voxelShape10);
@ -511,26 +363,26 @@ index d1d0fa66aa0c3e481b6d68fe36147040a730293f..5eb144366355f354e611b83b14669ef7
}
}
}
@@ -105,12 +108,12 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
@@ -127,12 +133,12 @@ public class WallBlock extends Block implements SimpleWaterloggedBlock {
@Override
public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
- return this.shapeByIndex.get(state);
+ return shapeByIndex.get(state.getValues());
}
@Override
public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
protected VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
- return this.collisionShapeByIndex.get(state);
+ return collisionShapeByIndex.get(state.getValues());
}
@Override
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
index de4c1e4701236e7d5ec77339c51ad6a9d8288bb6..960e85b9253f4b5162610ca0db54f3a911a8d50b 100644
index ded6d148110fe3fbb6272ce44582a28472dd49a6..16fe0554f38665cd652eef8fe693371c5de4542a 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -73,6 +73,7 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
@@ -77,6 +77,7 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.Vec3;
@ -538,7 +390,7 @@ index de4c1e4701236e7d5ec77339c51ad6a9d8288bb6..960e85b9253f4b5162610ca0db54f3a9
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
@@ -1358,7 +1359,7 @@ public abstract class BlockBehaviour implements FeatureElement {
@@ -1435,7 +1436,7 @@ public abstract class BlockBehaviour implements FeatureElement {
}
}
@ -548,22 +400,23 @@ index de4c1e4701236e7d5ec77339c51ad6a9d8288bb6..960e85b9253f4b5162610ca0db54f3a9
}
diff --git a/src/main/java/net/minecraft/world/level/block/state/StateDefinition.java b/src/main/java/net/minecraft/world/level/block/state/StateDefinition.java
index aa944f9a68c7a5171f84a58c9245d9acd7ca4ebd..1047e7818e8b26b3859bc0158a84721ea2c549d5 100644
index 46af72761c0bfbc10c14d78c855255969e2cf8a3..0df8011cd0809045986179e49ef7e2f459168f07 100644
--- a/src/main/java/net/minecraft/world/level/block/state/StateDefinition.java
+++ b/src/main/java/net/minecraft/world/level/block/state/StateDefinition.java
@@ -11,17 +11,16 @@ import com.mojang.serialization.Codec;
import com.mojang.serialization.Decoder;
@@ -11,10 +11,8 @@ import com.mojang.serialization.Decoder;
import com.mojang.serialization.Encoder;
import com.mojang.serialization.MapCodec;
import it.unimi.dsi.fastutil.objects.Reference2ObjectArrayMap;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
+
+import java.util.*;
import java.util.Map.Entry;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.regex.Pattern;
@@ -22,7 +20,8 @@ import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.Nullable;
@ -573,7 +426,7 @@ index aa944f9a68c7a5171f84a58c9245d9acd7ca4ebd..1047e7818e8b26b3859bc0158a84721e
public class StateDefinition<O, S extends StateHolder<O, S>> {
static final Pattern NAME_PATTERN = Pattern.compile("^[a-z0-9_]+$");
@@ -42,7 +41,6 @@ public class StateDefinition<O, S extends StateHolder<O, S>> {
@@ -41,7 +40,6 @@ public class StateDefinition<O, S extends StateHolder<O, S>> {
}
MapCodec<S> mapCodec2 = mapCodec;
@ -581,29 +434,33 @@ index aa944f9a68c7a5171f84a58c9245d9acd7ca4ebd..1047e7818e8b26b3859bc0158a84721e
List<S> list = Lists.newArrayList();
Stream<List<Pair<Property<?>, Comparable<?>>>> stream = Stream.of(Collections.emptyList());
@@ -56,17 +54,14 @@ public class StateDefinition<O, S extends StateHolder<O, S>> {
});
@@ -53,6 +51,7 @@ public class StateDefinition<O, S extends StateHolder<O, S>> {
}));
}
+ NeighbourTable<S> table = new NeighbourTable<>(propertiesMap);
stream.forEach((list2) -> {
ImmutableMap<Property<?>, Comparable<?>> immutableMap = list2.stream().collect(ImmutableMap.toImmutableMap(Pair::getFirst, Pair::getSecond));
S stateHolder = factory.create(owner, immutableMap, mapCodec2);
- map.put(immutableMap, stateHolder);
list.add(stateHolder);
+ stateHolder.populateNeighbours(table, table.put(immutableMap, stateHolder));
});
stream.forEach(list2 -> {
Reference2ObjectArrayMap<Property<?>, Comparable<?>> reference2ObjectArrayMap = new Reference2ObjectArrayMap<>(list2.size());
- for(S stateHolder : list) {
@@ -61,13 +60,10 @@ public class StateDefinition<O, S extends StateHolder<O, S>> {
}
S stateHolderx = factory.create(owner, reference2ObjectArrayMap, mapCodec2);
- map.put(reference2ObjectArrayMap, stateHolderx);
list.add(stateHolderx);
- });
- for (S stateHolder : list) {
- stateHolder.populateNeighbours(map);
- }
-
+ stateHolder.populateNeighbours(table, table.put(immutableMap, stateHolder));
+ });
this.states = ImmutableList.copyOf(list);
}
@@ -155,4 +150,60 @@ public class StateDefinition<O, S extends StateHolder<O, S>> {
@@ -157,4 +153,60 @@ public class StateDefinition<O, S extends StateHolder<O, S>> {
public interface Factory<O, S> {
S create(O owner, ImmutableMap<Property<?>, Comparable<?>> entries, MapCodec<S> codec);
S create(O owner, Reference2ObjectArrayMap<Property<?>, Comparable<?>> propertyMap, MapCodec<S> codec);
}
+
+ public static class NeighbourTable<S> {
@ -663,24 +520,24 @@ index aa944f9a68c7a5171f84a58c9245d9acd7ca4ebd..1047e7818e8b26b3859bc0158a84721e
+ }
}
diff --git a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java
index 5f285d190186a2ff5a61d05070593e1d633dd79a..694a500a49a9f629ea8514cab37ef99e69ef1fb9 100644
index 45744d86e9582a93a0cec26009deea091080fbbe..7e2ecb0457150dedc665f05c6c8ad068c00e3642 100644
--- a/src/main/java/net/minecraft/world/level/block/state/StateHolder.java
+++ b/src/main/java/net/minecraft/world/level/block/state/StateHolder.java
@@ -37,15 +37,14 @@ public abstract class StateHolder<O, S> {
};
protected final O owner;
private final ImmutableMap<Property<?>, Comparable<?>> values;
private final Reference2ObjectArrayMap<Property<?>, Comparable<?>> values;
- private Table<Property<?>, Comparable<?>, S> neighbours;
protected final MapCodec<S> propertiesCodec;
- protected final io.papermc.paper.util.table.ZeroCollidingReferenceStateTable optimisedTable; // Paper - optimise state lookup
+ private StateDefinition.NeighbourTable<S> neighbourTable;
+ private int neighbourIndex;
protected StateHolder(O owner, ImmutableMap<Property<?>, Comparable<?>> entries, MapCodec<S> codec) {
protected StateHolder(O owner, Reference2ObjectArrayMap<Property<?>, Comparable<?>> propertyMap, MapCodec<S> codec) {
this.owner = owner;
this.values = entries;
this.values = propertyMap;
this.propertiesCodec = codec;
- this.optimisedTable = new io.papermc.paper.util.table.ZeroCollidingReferenceStateTable(this, entries); // Paper - optimise state lookup
- this.optimisedTable = new io.papermc.paper.util.table.ZeroCollidingReferenceStateTable(this, propertyMap); // Paper - optimise state lookup
}
public <T extends Comparable<T>> S cycle(Property<T> property) {
@ -739,10 +596,10 @@ index 5f285d190186a2ff5a61d05070593e1d633dd79a..694a500a49a9f629ea8514cab37ef99e
- } else {
- Table<Property<?>, Comparable<?>, S> table = HashBasedTable.create();
-
- for(Map.Entry<Property<?>, Comparable<?>> entry : this.values.entrySet()) {
- for (Entry<Property<?>, Comparable<?>> entry : this.values.entrySet()) {
- Property<?> property = entry.getKey();
-
- for(Comparable<?> comparable : property.getPossibleValues()) {
- for (Comparable<?> comparable : property.getPossibleValues()) {
- if (!comparable.equals(entry.getValue())) {
- table.put(property, comparable, states.get(this.makeNeighbourValues(property, comparable)));
- }
@ -758,10 +615,10 @@ index 5f285d190186a2ff5a61d05070593e1d633dd79a..694a500a49a9f629ea8514cab37ef99e
private Map<Property<?>, Comparable<?>> makeNeighbourValues(Property<?> property, Comparable<?> value) {
diff --git a/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java b/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java
index ef8b794d1a017f02f90368a48cec2ea7bb57f218..9a73d051902164fe8d8adb5792f2d7868de31381 100644
index 427ee4d6f12a7abd8da0c65e0b9081b25824df40..4c2ad01150972940688cb8301fc84a210844c48f 100644
--- a/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java
+++ b/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java
@@ -497,7 +497,6 @@ public class LevelStorageSource {
@@ -507,7 +507,6 @@ public class LevelStorageSource {
public class LevelStorageAccess implements AutoCloseable {
@ -769,15 +626,15 @@ index ef8b794d1a017f02f90368a48cec2ea7bb57f218..9a73d051902164fe8d8adb5792f2d786
public final LevelStorageSource.LevelDirectory levelDirectory;
private final String levelId;
private final Map<LevelResource, Path> resources = Maps.newHashMap();
@@ -509,7 +508,6 @@ public class LevelStorageSource {
@@ -519,7 +518,6 @@ public class LevelStorageSource {
// CraftBukkit end
this.levelId = s;
this.levelDirectory = new LevelStorageSource.LevelDirectory(path);
- this.lock = DirectoryLock.create(path);
}
public String getLevelId() {
@@ -529,9 +527,7 @@ public class LevelStorageSource {
public long estimateDiskSpace() {
@@ -568,9 +566,7 @@ public class LevelStorageSource {
}
private void checkLock() {
@ -788,7 +645,7 @@ index ef8b794d1a017f02f90368a48cec2ea7bb57f218..9a73d051902164fe8d8adb5792f2d786
}
public PlayerDataStorage createPlayerStorage() {
@@ -583,7 +579,7 @@ public class LevelStorageSource {
@@ -626,7 +622,7 @@ public class LevelStorageSource {
}
public Optional<Path> getIconFile() {
@ -797,7 +654,7 @@ index ef8b794d1a017f02f90368a48cec2ea7bb57f218..9a73d051902164fe8d8adb5792f2d786
}
public void deleteLevel() throws IOException {
@@ -612,7 +608,6 @@ public class LevelStorageSource {
@@ -655,7 +651,6 @@ public class LevelStorageSource {
throw ioexception;
} else {
if (path1.equals(LevelStorageAccess.this.levelDirectory.path())) {
@ -805,20 +662,20 @@ index ef8b794d1a017f02f90368a48cec2ea7bb57f218..9a73d051902164fe8d8adb5792f2d786
Files.deleteIfExists(path);
}
@@ -703,7 +698,7 @@ public class LevelStorageSource {
@@ -757,7 +752,7 @@ public class LevelStorageSource {
}
public void close() throws IOException {
- this.lock.close();
+ //ignored
}
}
}
public boolean restoreLevelDataFromOld() {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 249d76acac9a91cd46f0b8a477511974a75d6f4a..00bd7100fe2dd5787c57c5fea68e13a08d03c22d 100644
index c8b82bc41f2042bb4b067f06265a3a22e51f7629..e7f63e2f9271b05748db152be43ce9dfad6ff3a5 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -492,7 +492,7 @@ public final class CraftServer implements Server {
@@ -502,7 +502,7 @@ public final class CraftServer implements Server {
try {
this.configuration.save(this.getConfigFile());
} catch (IOException ex) {
@ -827,7 +684,7 @@ index 249d76acac9a91cd46f0b8a477511974a75d6f4a..00bd7100fe2dd5787c57c5fea68e13a0
}
}
@@ -500,7 +500,7 @@ public final class CraftServer implements Server {
@@ -510,7 +510,7 @@ public final class CraftServer implements Server {
try {
this.commandsConfiguration.save(this.getCommandsConfigFile());
} catch (IOException ex) {
@ -836,7 +693,7 @@ index 249d76acac9a91cd46f0b8a477511974a75d6f4a..00bd7100fe2dd5787c57c5fea68e13a0
}
}
@@ -562,7 +562,7 @@ public final class CraftServer implements Server {
@@ -600,7 +600,7 @@ public final class CraftServer implements Server {
DefaultPermissions.registerCorePermissions();
CraftDefaultPermissions.registerCorePermissions();
if (!io.papermc.paper.configuration.GlobalConfiguration.get().misc.loadPermissionsYmlBeforePlugins) this.loadCustomPermissions(); // Paper
@ -845,58 +702,12 @@ index 249d76acac9a91cd46f0b8a477511974a75d6f4a..00bd7100fe2dd5787c57c5fea68e13a0
this.syncCommands();
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
index 776b7fc26fe96b69be260bbd36efae147d988640..016a9b4b06a5a5a19a458db7a26d45420165502d 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -300,7 +300,7 @@ public class Main {
}
// Paper start - Log Java and OS versioning to help with debugging plugin issues
- java.lang.management.RuntimeMXBean runtimeMX = java.lang.management.ManagementFactory.getRuntimeMXBean();
+ /*java.lang.management.RuntimeMXBean runtimeMX = java.lang.management.ManagementFactory.getRuntimeMXBean();
java.lang.management.OperatingSystemMXBean osMX = java.lang.management.ManagementFactory.getOperatingSystemMXBean();
if (runtimeMX != null && osMX != null) {
String javaInfo = "Java " + runtimeMX.getSpecVersion() + " (" + runtimeMX.getVmName() + " " + runtimeMX.getVmVersion() + ")";
@@ -309,7 +309,7 @@ public class Main {
System.out.println("System Info: " + javaInfo + " " + osInfo);
} else {
System.out.println("Unable to read system info");
- }
+ }*/
// Paper end
System.setProperty( "library.jansi.version", "Paper" ); // Paper - set meaningless jansi version to prevent git builds from crashing on Windows
System.out.println("Loading libraries, please wait...");
@@ -356,10 +356,6 @@ public class Main {
tryPreloadClass("com.destroystokyo.paper.event.player.PlayerConnectionCloseEvent");
tryPreloadClass("com.destroystokyo.paper.event.entity.EntityRemoveFromWorldEvent");
// Minecraft, seen during saving
- tryPreloadClass(net.minecraft.world.level.lighting.LayerLightEventListener.DummyLightLayerEventListener.class.getName());
- tryPreloadClass(net.minecraft.world.level.lighting.LayerLightEventListener.class.getName());
- tryPreloadClass(net.minecraft.util.ExceptionCollector.class.getName());
- tryPreloadClass(io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.PlayerChunkLoaderData.class.getName());
// Paper end
}
}
@@ -369,11 +365,7 @@ public class Main {
tryPreloadClass(className, true);
}
private static void tryPreloadClass(String className, boolean printError) {
- try {
- Class.forName(className);
- } catch (ClassNotFoundException e) {
- if (printError) System.err.println("An expected class " + className + " was not found for preloading: " + e.getMessage());
- }
+ //no wtf!
}
// Paper end
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
index 612c3169c3463d702b85975e1db79ae6e47d60d0..367d2c6d30b70a71d8198a5f9188e98506750dfb 100644
index 4dbb109d0526afee99b9190fc256585121aac9b5..3e819b143f62506d733ca88f585ba016c6765045 100644
--- a/src/main/java/org/spigotmc/SpigotConfig.java
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
@@ -130,7 +130,7 @@ public class SpigotConfig
SpigotConfig.config.save( CONFIG_FILE );
@@ -126,7 +126,7 @@ public class SpigotConfig
SpigotConfig.config.save( SpigotConfig.CONFIG_FILE );
} catch ( IOException ex )
{
- Bukkit.getLogger().log( Level.SEVERE, "Could not save " + SpigotConfig.CONFIG_FILE, ex );

Datei-Diff unterdrückt, da er zu groß ist Diff laden