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
// CraftBukkit end
MinecraftServer.LOGGER.info("Stopping server");
MinecraftTimings.stopServer(); // Paper
if (this.metricsRecorder.isRecording()) {
this.cancelRecordingMetrics();
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.getProfileCache().save(false); // Paper
}
@ -145,9 +145,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
protected void runServer() {
try {
+ long serverStartTime = Util.getNanos(); // Paper
if (this.initServer()) {
this.nextTickTime = Util.getMillis();
this.status.setDescription(new TextComponent(this.motd));
if (!this.initServer()) {
throw new IllegalStateException("Failed to initialize server");
}
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.updateStatusIcon(this.status);
@ -168,7 +168,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
Arrays.fill( recentTps, 20 );
long start = System.nanoTime(), curTime, tickSection = start; // Paper - Further improve server tick loop
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.onServerCrash((CrashReport) null);
JvmProfiler.INSTANCE.onServerTick(this.averageTickTime);
}
} catch (Throwable throwable) {
+ // Paper start
@ -181,7 +181,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
// Spigot Start
if ( throwable.getCause() != null )
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.profileCache.clearExecutor();
this.services.profileCache().clearExecutor();
}
- 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().reloadResources();
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
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- 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
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -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 boolean collisionLoadChunks = false; // Paper

View File

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

View File

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