moar patches

This commit is contained in:
Jake Potrebic
2022-06-07 21:22:42 -07:00
parent ac0e1997ee
commit 194d219e0a
14 changed files with 53 additions and 53 deletions

View File

@@ -119,8 +119,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ // Paper end + // Paper end
// CraftBukkit end // CraftBukkit end
MinecraftServer.LOGGER.info("Stopping server"); if (this.metricsRecorder.isRecording()) {
MinecraftTimings.stopServer(); // Paper this.cancelRecordingMetrics();
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.getProfileCache().save(false); // Paper this.getProfileCache().save(false); // Paper
} }
@@ -145,9 +145,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
protected void runServer() { protected void runServer() {
try { try {
+ long serverStartTime = Util.getNanos(); // Paper + long serverStartTime = Util.getNanos(); // Paper
if (this.initServer()) { if (!this.initServer()) {
this.nextTickTime = Util.getMillis(); throw new IllegalStateException("Failed to initialize server");
this.status.setDescription(new TextComponent(this.motd)); }
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.updateStatusIcon(this.status); this.updateStatusIcon(this.status);
@@ -168,7 +168,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
Arrays.fill( recentTps, 20 ); Arrays.fill( recentTps, 20 );
long start = System.nanoTime(), curTime, tickSection = start; // Paper - Further improve server tick loop long start = System.nanoTime(), curTime, tickSection = start; // Paper - Further improve server tick loop
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.onServerCrash((CrashReport) null); JvmProfiler.INSTANCE.onServerTick(this.averageTickTime);
} }
} catch (Throwable throwable) { } catch (Throwable throwable) {
+ // Paper start + // Paper start
@@ -181,7 +181,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// Spigot Start // Spigot Start
if ( throwable.getCause() != null ) if ( throwable.getCause() != null )
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.profileCache.clearExecutor(); this.services.profileCache().clearExecutor();
} }
- org.spigotmc.WatchdogThread.doStop(); // Spigot - org.spigotmc.WatchdogThread.doStop(); // Spigot
@@ -228,7 +228,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ //this.getPlayerList().saveAll(); // Paper - we don't need to do this + //this.getPlayerList().saveAll(); // Paper - we don't need to do this
this.getPlayerList().reloadResources(); this.getPlayerList().reloadResources();
this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary()); this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary());
this.structureManager.onResourceManagerReload(this.resources.resourceManager); this.structureTemplateManager.onResourceManagerReload(this.resources.resourceManager);
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java

View File

@@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/entity/Entity.java --- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { @@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
// Paper end public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason; // Paper
public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper
+ public boolean collisionLoadChunks = false; // Paper + public boolean collisionLoadChunks = false; // Paper

View File

@@ -59,7 +59,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} else if (!world.getGameRules().getBoolean(GameRules.RULE_DO_PATROL_SPAWNING)) { } else if (!world.getGameRules().getBoolean(GameRules.RULE_DO_PATROL_SPAWNING)) {
@@ -0,0 +0,0 @@ public class PatrolSpawner implements CustomSpawner { @@ -0,0 +0,0 @@ public class PatrolSpawner implements CustomSpawner {
} else { } else {
Random random = world.random; RandomSource randomsource = world.random;
- --this.nextTick; - --this.nextTick;
- if (this.nextTick > 0) { - if (this.nextTick > 0) {
@@ -70,7 +70,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return 0; return 0;
+ } + }
+ +
+ net.minecraft.server.level.ServerPlayer entityhuman = world.players().get(random.nextInt(j)); + net.minecraft.server.level.ServerPlayer entityhuman = world.players().get(randomsource.nextInt(j));
+ if (entityhuman.isSpectator()) { + if (entityhuman.isSpectator()) {
+ return 0; + return 0;
+ } + }
@@ -80,7 +80,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ --entityhuman.patrolSpawnDelay; + --entityhuman.patrolSpawnDelay;
+ patrolSpawnDelay = entityhuman.patrolSpawnDelay; + patrolSpawnDelay = entityhuman.patrolSpawnDelay;
} else { } else {
- this.nextTick += 12000 + random.nextInt(1200); - this.nextTick += 12000 + randomsource.nextInt(1200);
- long i = world.getDayTime() / 24000L; - long i = world.getDayTime() / 24000L;
+ this.nextTick--; + this.nextTick--;
+ patrolSpawnDelay = this.nextTick; + patrolSpawnDelay = this.nextTick;
@@ -96,15 +96,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ days = world.getDayTime() / 24000L; + days = world.getDayTime() / 24000L;
+ } + }
+ if (world.paperConfig.patrolPerPlayerDelay) { + if (world.paperConfig.patrolPerPlayerDelay) {
+ entityhuman.patrolSpawnDelay += world.paperConfig.patrolDelay + random.nextInt(1200); + entityhuman.patrolSpawnDelay += world.paperConfig.patrolDelay + randomsource.nextInt(1200);
+ } else { + } else {
+ this.nextTick += world.paperConfig.patrolDelay + random.nextInt(1200); + this.nextTick += world.paperConfig.patrolDelay + randomsource.nextInt(1200);
+ } + }
- if (i >= 5L && world.isDay()) { - if (i >= 5L && world.isDay()) {
- if (random.nextInt(5) != 0) { - if (randomsource.nextInt(5) != 0) {
+ if (days >= world.paperConfig.patrolStartDay && world.isDay()) { + if (days >= world.paperConfig.patrolStartDay && world.isDay()) {
+ if (random.nextDouble() >= world.paperConfig.patrolSpawnChance) { + if (randomsource.nextDouble() >= world.paperConfig.patrolSpawnChance) {
+ // Paper end + // Paper end
return 0; return 0;
} else { } else {
@@ -113,7 +113,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (j < 1) { if (j < 1) {
return 0; return 0;
} else { } else {
- Player entityhuman = (Player) world.players().get(random.nextInt(j)); - Player entityhuman = (Player) world.players().get(randomsource.nextInt(j));
if (entityhuman.isSpectator()) { if (entityhuman.isSpectator()) {
return 0; return 0;

View File

@@ -39,8 +39,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
ServerPlayer entityplayer = (ServerPlayer) entity; ServerPlayer entityplayer = (ServerPlayer) entity;
@@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
entity.valid = true; // CraftBukkit entity.valid = true; // CraftBukkit
+ ServerLevel.this.getChunkSource().addEntity(entity); + ServerLevel.this.getChunkSource().addEntity(entity);
// Paper start - Set origin location when the entity is being added to the world // Paper start - Set origin location when the entity is being added to the world