mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@71c84c8 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277) PaperMC/Paper@e3bc4c4 Make debug mode print current configuration phase PaperMC/Paper@d0ebfbb Fix corrupted plugin.yml breaking plugin loading (#10279) PaperMC/Paper@681bbff Fix spawnreason saving
116 lines
8.9 KiB
Diff
116 lines
8.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: BillyGalbreath <blake.galbreath@gmail.com>
|
|
Date: Sun, 12 Jun 2022 09:18:57 -0500
|
|
Subject: [PATCH] Fix pufferfish issues
|
|
|
|
|
|
diff --git a/build.gradle.kts b/build.gradle.kts
|
|
index 7e82d2c6a6085a5ea335ba9ef2a5ec3f5a37e787..32366253c04c493135f2b22d1940f83669104723 100644
|
|
--- a/build.gradle.kts
|
|
+++ b/build.gradle.kts
|
|
@@ -234,5 +234,7 @@ val runtimeClasspathForRunDev = sourceSets.main.flatMap { src ->
|
|
}
|
|
tasks.registerRunTask("runDev") {
|
|
description = "Spin up a non-relocated Mojang-mapped test server"
|
|
- classpath(sourceSets.main.map { it.runtimeClasspath })
|
|
+ classpath(tasks.filterProjectDir.flatMap { it.outputJar })
|
|
+ classpath(runtimeClasspathForRunDev)
|
|
+ jvmArgs("-DPaper.isRunDev=true")
|
|
}
|
|
diff --git a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
|
|
index f6a3364175476c57a7763a087ff55e1689474800..5e01bfdad663656168604fc878a993dd910bf45b 100644
|
|
--- a/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
|
|
+++ b/src/main/java/gg/pufferfish/pufferfish/PufferfishConfig.java
|
|
@@ -232,7 +232,7 @@ public class PufferfishConfig {
|
|
public static int activationDistanceMod;
|
|
|
|
private static void dynamicActivationOfBrains() throws IOException {
|
|
- dearEnabled = getBoolean("dab.enabled", "activation-range.enabled", true);
|
|
+ dearEnabled = getBoolean("dab.enabled", "activation-range.enabled", false); // Purpur
|
|
startDistance = getInt("dab.start-distance", "activation-range.start-distance", 12,
|
|
"This value determines how far away an entity has to be",
|
|
"from the player to start being effected by DEAR.");
|
|
@@ -276,7 +276,7 @@ public class PufferfishConfig {
|
|
|
|
public static boolean throttleInactiveGoalSelectorTick;
|
|
private static void inactiveGoalSelectorThrottle() {
|
|
- throttleInactiveGoalSelectorTick = getBoolean("inactive-goal-selector-throttle", "inactive-goal-selector-disable", true,
|
|
+ throttleInactiveGoalSelectorTick = getBoolean("inactive-goal-selector-throttle", "inactive-goal-selector-disable", false, // Purpur
|
|
"Throttles the AI goal selector in entity inactive ticks.",
|
|
"This can improve performance by a few percent, but has minor gameplay implications.");
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
index 531c9ef0d6504fc1632b83bd93b9cf76e91377e8..09594f96cf79aa38142a859bef2e3b6b8d00f7db 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
|
@@ -924,7 +924,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
final String msg = String.format("Entity threw exception at %s:%s,%s,%s", entity.level().getWorld().getName(), entity.getX(), entity.getY(), entity.getZ());
|
|
MinecraftServer.LOGGER.error(msg, throwable);
|
|
getCraftServer().getPluginManager().callEvent(new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerInternalException(msg, throwable)));
|
|
- entity.discard();
|
|
+ entity.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD); // Purpur
|
|
// Paper end
|
|
}
|
|
// Pufferfish end
|
|
@@ -992,7 +992,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
|
}
|
|
// Paper start - optimise random block ticking
|
|
private final BlockPos.MutableBlockPos chunkTickMutablePosition = new BlockPos.MutableBlockPos();
|
|
- // private final io.papermc.paper.util.math.ThreadUnsafeRandom randomTickRandom = new io.papermc.paper.util.math.ThreadUnsafeRandom(); // Pufferfish - moved to super
|
|
+ private final io.papermc.paper.util.math.ThreadUnsafeRandom randomTickRandom = new io.papermc.paper.util.math.ThreadUnsafeRandom(this.random.nextLong()); public net.minecraft.util.RandomSource getThreadUnsafeRandom() { return this.randomTickRandom; } // Pufferfish - moved to super // Purpur - dont break ABI
|
|
// Paper end
|
|
|
|
private int currentIceAndSnowTick = 0; protected void resetIceAndSnowTick() { this.currentIceAndSnowTick = this.randomTickRandom.nextInt(16); } // Pufferfish
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
index 098c410f0285948d7ac48835c352f9c97742c5c7..3773b05d0e2875db8817835e623272292855925f 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -825,7 +825,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
|
public void tick() {
|
|
// Pufferfish start - entity TTL
|
|
if (type != EntityType.PLAYER && type.ttl >= 0 && this.tickCount >= type.ttl) {
|
|
- discard();
|
|
+ discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD); // Purpur
|
|
return;
|
|
}
|
|
// Pufferfish end - entity TTL
|
|
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
|
index 837f68825f601971f374be47952b23108bf66ba6..2a8a8030feefae84e394460612405887e63f2ac7 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
|
@@ -64,7 +64,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
|
if (!isLoaded) {
|
|
if (Projectile.loadedThisTick > gg.pufferfish.pufferfish.PufferfishConfig.maxProjectileLoadsPerTick) {
|
|
if (++this.loadedLifetime > gg.pufferfish.pufferfish.PufferfishConfig.maxProjectileLoadsPerProjectile) {
|
|
- this.discard();
|
|
+ this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD); // Purpur
|
|
}
|
|
return;
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
|
index 506100b02e7e9a3eabfde6b1f93858c4cc048524..27447e4acb7db91b7595a7c25b682a4a4ce8c151 100644
|
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
|
@@ -207,7 +207,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
|
|
public abstract ResourceKey<LevelStem> getTypeKey();
|
|
|
|
- protected final io.papermc.paper.util.math.ThreadUnsafeRandom randomTickRandom = new io.papermc.paper.util.math.ThreadUnsafeRandom(java.util.concurrent.ThreadLocalRandom.current().nextLong()); public net.minecraft.util.RandomSource getThreadUnsafeRandom() { return this.randomTickRandom; } // Pufferfish - move thread unsafe random initialization // Pufferfish - getter
|
|
+ //protected final io.papermc.paper.util.math.ThreadUnsafeRandom randomTickRandom = new io.papermc.paper.util.math.ThreadUnsafeRandom(java.util.concurrent.ThreadLocalRandom.current().nextLong()); public net.minecraft.util.RandomSource getThreadUnsafeRandom() { return this.randomTickRandom; } // Pufferfish - move thread unsafe random initialization // Pufferfish - getter // Purpur - dont break ABI
|
|
|
|
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - create paper world config; Async-Anti-Xray: Pass executor
|
|
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
|
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
|
index 922191159fadf8e89646d7299aadee4aa851f71a..5fab6909bd2ee303f49b7e667617bcae608e82d7 100644
|
|
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
|
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
|
@@ -122,7 +122,7 @@ public class LevelChunk extends ChunkAccess {
|
|
this.blockTicks = blockTickScheduler;
|
|
this.fluidTicks = fluidTickScheduler;
|
|
|
|
- this.lightningTick = this.level.getThreadUnsafeRandom().nextInt(100000) << 1; // Pufferfish - initialize lightning tick
|
|
+ this.lightningTick = java.util.concurrent.ThreadLocalRandom.current().nextInt(100000) << 1; // Pufferfish - initialize lightning tick // Purpur - any random will do
|
|
}
|
|
|
|
// CraftBukkit start
|