diff --git a/patches/todo/server/0010-Use-unused-ghast-sound.patch b/patches/removed/1.20/server/0010-Use-unused-ghast-sound.patch similarity index 100% rename from patches/todo/server/0010-Use-unused-ghast-sound.patch rename to patches/removed/1.20/server/0010-Use-unused-ghast-sound.patch diff --git a/patches/todo/server/0013-Paper-PR-Add-Movement-Direction-API.patch b/patches/removed/1.20/server/0013-Paper-PR-Add-Movement-Direction-API.patch similarity index 100% rename from patches/todo/server/0013-Paper-PR-Add-Movement-Direction-API.patch rename to patches/removed/1.20/server/0013-Paper-PR-Add-Movement-Direction-API.patch diff --git a/patches/todo/server/0014-Paper-PR-BoneMeal-API.patch b/patches/removed/1.20/server/0014-Paper-PR-BoneMeal-API.patch similarity index 100% rename from patches/todo/server/0014-Paper-PR-BoneMeal-API.patch rename to patches/removed/1.20/server/0014-Paper-PR-BoneMeal-API.patch diff --git a/patches/todo/server/0015-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch b/patches/removed/1.20/server/0015-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch similarity index 100% rename from patches/todo/server/0015-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch rename to patches/removed/1.20/server/0015-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch diff --git a/patches/server/0008-Fix-entity-serialization.patch b/patches/server/0007-Fix-entity-serialization.patch similarity index 90% rename from patches/server/0008-Fix-entity-serialization.patch rename to patches/server/0007-Fix-entity-serialization.patch index 5357faf..61abbb7 100644 --- a/patches/server/0008-Fix-entity-serialization.patch +++ b/patches/server/0007-Fix-entity-serialization.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix entity serialization diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index e71eca3ddbbeb3168dd73433b6d6ffe9f6755f77..a5b7194823027446117b14fbf916f2cb16e5679f 100644 +index 6417fd26d7675c967986055067ce8876a1263e9f..ff8258b1146d2899037a1fbd0ebc985df342eff4 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2184,15 +2184,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { +@@ -2288,15 +2288,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { } } @@ -25,7 +25,7 @@ index e71eca3ddbbeb3168dd73433b6d6ffe9f6755f77..a5b7194823027446117b14fbf916f2cb return this.isPassenger() ? false : this.saveAsPassenger(nbt); } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 1bf9a11abf7884a421374cbca5ccc18480717b79..32bc9099fea1fed7c94bff27cb897cdb4aab9e73 100644 +index 09c39f72fe1e8e6967f415dfd0d7aea8e50d0379..35f01d3c4d4318383ecd8a08b378285fffe07d62 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -498,8 +498,13 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/todo/server/0011-Don-t-save-Fireworks.patch b/patches/server/0008-Don-t-save-Fireworks.patch similarity index 90% rename from patches/todo/server/0011-Don-t-save-Fireworks.patch rename to patches/server/0008-Don-t-save-Fireworks.patch index c1240cd..40ef579 100644 --- a/patches/todo/server/0011-Don-t-save-Fireworks.patch +++ b/patches/server/0008-Don-t-save-Fireworks.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Don't save Fireworks diff --git a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java -index fca27f98989bf106060ba08196255fe32f850df5..d76c9090a1cd860cc73735a86beb637e2378df47 100644 +index 288910fb168ddc5d3a61971778b8038a56772fa8..f0b208b90f15ffd55572dbe94e2a1cc7a448aa0c 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java +++ b/src/main/java/net/minecraft/world/entity/projectile/FireworkRocketEntity.java @@ -357,4 +357,11 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { diff --git a/patches/todo/server/0017-EMC-Allow-negative-Amplifier-values.patch b/patches/server/0009-EMC-Allow-negative-Amplifier-values.patch similarity index 100% rename from patches/todo/server/0017-EMC-Allow-negative-Amplifier-values.patch rename to patches/server/0009-EMC-Allow-negative-Amplifier-values.patch diff --git a/patches/todo/server/0012-Remove-Spigot-tick-limiter.patch b/patches/server/0010-Remove-Spigot-tick-limiter.patch similarity index 87% rename from patches/todo/server/0012-Remove-Spigot-tick-limiter.patch rename to patches/server/0010-Remove-Spigot-tick-limiter.patch index b6ad103..045254b 100644 --- a/patches/todo/server/0012-Remove-Spigot-tick-limiter.patch +++ b/patches/server/0010-Remove-Spigot-tick-limiter.patch @@ -7,10 +7,10 @@ Original code by Titaniumtown, modified by NONPLAYT You can find the original code on https://gitlab.com/Titaniumtown/JettPack diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index e39b3c7a67de82dd5165f9276f374cd89ecf96c9..4bacba49a3e462e21b25f388293f255406ffb9b5 100644 +index 454ad3442076898dd476d86706f93facae1939af..e34fdd46a0c00a02dd8828140e294fa66ddb1770 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -183,8 +183,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -182,8 +182,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable { public final gq.bxteam.divinemc.configuration.DivineWorldConfig divinemcConfig; // DivineMC public final co.aikar.timings.WorldTimingsHandler timings; // Paper public static BlockPos lastPhysicsProblem; // Spigot @@ -19,7 +19,7 @@ index e39b3c7a67de82dd5165f9276f374cd89ecf96c9..4bacba49a3e462e21b25f388293f2554 private int tileTickPosition; public final Map explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions public java.util.ArrayDeque redstoneUpdateInfos; // Paper - Move from Map in BlockRedstoneTorch to here -@@ -426,8 +424,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable { +@@ -407,8 +405,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable { // CraftBukkit end timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings this.keepSpawnInMemory = this.paperConfig().spawn.keepSpawnLoaded; // Paper @@ -29,18 +29,18 @@ index e39b3c7a67de82dd5165f9276f374cd89ecf96c9..4bacba49a3e462e21b25f388293f2554 } diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index e863d524dd1f47332a294ebea604752b33cf2a16..65b10200844952c07296a16da2a8202c9d1d1e9c 100644 +index 5638290c72e0daeddfa79fd55e87334fa7d86f72..b1ddcb53b77020b43f68e2a5558e05fab207789d 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java -@@ -446,6 +446,7 @@ public class SpigotWorldConfig - this.hangingTickFrequency = this.getInt( "hanging-tick-frequency", 200 ); // DivineMC - optimize default values for configs +@@ -448,6 +448,7 @@ public class SpigotWorldConfig + this.hangingTickFrequency = this.getInt( "hanging-tick-frequency", 100 ); } + /* DivineMC - remove tick limiter public int tileMaxTickTime; public int entityMaxTickTime; private void maxTickTimes() -@@ -454,6 +455,7 @@ public class SpigotWorldConfig +@@ -456,6 +457,7 @@ public class SpigotWorldConfig this.entityMaxTickTime = this.getInt("max-tick-time.entity", 50); this.log("Tile Max Tick Time: " + this.tileMaxTickTime + "ms Entity max Tick Time: " + this.entityMaxTickTime + "ms"); } diff --git a/patches/todo/server/0009-Boat-Settings.patch b/patches/server/0011-Boat-Settings.patch similarity index 77% rename from patches/todo/server/0009-Boat-Settings.patch rename to patches/server/0011-Boat-Settings.patch index 0c67be4..9a75442 100644 --- a/patches/todo/server/0009-Boat-Settings.patch +++ b/patches/server/0011-Boat-Settings.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Sun, 2 Apr 2023 22:02:28 +0300 +Date: Sat, 10 Jun 2023 13:01:08 +0300 Subject: [PATCH] Boat Settings @@ -22,16 +22,16 @@ index 5d16d2250bae9c982a0af9ad2580a63532b140f7..9eede8eb7fefc414f3a1207cd3ca2b33 } \ No newline at end of file diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java -index d3f722d13eb7a47d10dd77017d0918a9e55e390a..a6775a19897540a2ec556c53bbcc0f52c298c201 100644 +index 8f7666f3c33eaf2bee0d68cc4ef1cfab09dea08a..f1a7dc3e00f90be923828a1d812ae3026a584439 100644 --- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java +++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java @@ -357,7 +357,18 @@ public class Boat extends Entity implements VariantHolder { } - if (!this.level.isClientSide && this.outOfControlTicks >= 60.0F) { + if (!this.level().isClientSide && this.outOfControlTicks >= 60.0F) { - this.ejectPassengers(); + // DivineMC start - Don't eject players -+ if (this.level.divinemcConfig.dontEjectPlayerFromBoatUnderwater) { ++ if (this.level().divinemcConfig.dontEjectPlayerFromBoatUnderwater) { + for (int i = this.passengers.size() - 1; i >= 0; --i) { + Entity passenger = this.passengers.get(i); + if (!(passenger instanceof Player)) { @@ -49,12 +49,12 @@ index d3f722d13eb7a47d10dd77017d0918a9e55e390a..a6775a19897540a2ec556c53bbcc0f52 @Override public InteractionResult interact(Player player, InteractionHand hand) { -- return player.isSecondaryUseActive() ? InteractionResult.PASS : (this.outOfControlTicks < 60.0F ? (!this.level.isClientSide ? (player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS) : InteractionResult.SUCCESS) : InteractionResult.PASS); +- return player.isSecondaryUseActive() ? InteractionResult.PASS : (this.outOfControlTicks < 60.0F ? (!this.level().isClientSide ? (player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS) : InteractionResult.SUCCESS) : InteractionResult.PASS); + // DivineMC start - always allow to enter the boat -+ if (this.level.divinemcConfig.alwaysAllowToEnterTheBoat) { -+ return player.isSecondaryUseActive() ? InteractionResult.PASS : (true || this.outOfControlTicks < 60.0F ? (!this.level.isClientSide ? (player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS) : InteractionResult.SUCCESS) : InteractionResult.PASS); ++ if (this.level().divinemcConfig.alwaysAllowToEnterTheBoat) { ++ return player.isSecondaryUseActive() ? InteractionResult.PASS : (true || this.outOfControlTicks < 60.0F ? (!this.level().isClientSide ? (player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS) : InteractionResult.SUCCESS) : InteractionResult.PASS); + } else { -+ return player.isSecondaryUseActive() ? InteractionResult.PASS : (this.outOfControlTicks < 60.0F ? (!this.level.isClientSide ? (player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS) : InteractionResult.SUCCESS) : InteractionResult.PASS); ++ return player.isSecondaryUseActive() ? InteractionResult.PASS : (this.outOfControlTicks < 60.0F ? (!this.level().isClientSide ? (player.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS) : InteractionResult.SUCCESS) : InteractionResult.PASS); + } + // DivineMC end } @@ -66,7 +66,7 @@ index d3f722d13eb7a47d10dd77017d0918a9e55e390a..a6775a19897540a2ec556c53bbcc0f52 protected boolean canAddPassenger(Entity passenger) { - return this.getPassengers().size() < this.getMaxPassengers() && !this.isEyeInFluid(FluidTags.WATER); + // DivineMC start - always allow to enter the boat -+ if (this.level.divinemcConfig.alwaysAllowToEnterTheBoat) { ++ if (this.level().divinemcConfig.alwaysAllowToEnterTheBoat) { + return this.getPassengers().size() < this.getMaxPassengers()/* && !this.isEyeInFluid(FluidTags.WATER)*/; + } else { + return this.getPassengers().size() < this.getMaxPassengers() && !this.isEyeInFluid(FluidTags.WATER); diff --git a/patches/todo/server/0019-Fallback-to-Dimension-if-World-UUID-is-unknown.patch b/patches/server/0012-Fallback-to-Dimension-if-World-UUID-is-unknown.patch similarity index 94% rename from patches/todo/server/0019-Fallback-to-Dimension-if-World-UUID-is-unknown.patch rename to patches/server/0012-Fallback-to-Dimension-if-World-UUID-is-unknown.patch index eda12b9..0f02dec 100644 --- a/patches/todo/server/0019-Fallback-to-Dimension-if-World-UUID-is-unknown.patch +++ b/patches/server/0012-Fallback-to-Dimension-if-World-UUID-is-unknown.patch @@ -20,7 +20,7 @@ index 0a8baeb94ae553c4759b065eafd9e242153cf991..abf8ddccce6ec9d893038d1fafdca617 } \ No newline at end of file diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 1a90a7d91288b9a8ab3539785de2616a6f24aa48..2a3025d16a3ca02ce1566a96b8bf3bea45ccb0c1 100644 +index 725149019d69f3350b7235391092b1fbe2cd9dfb..fc67dc67664a207b761ff4d8df0a206bd4a41547 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -102,6 +102,7 @@ import net.minecraft.world.scores.PlayerTeam; @@ -31,7 +31,7 @@ index 1a90a7d91288b9a8ab3539785de2616a6f24aa48..2a3025d16a3ca02ce1566a96b8bf3bea // CraftBukkit start import java.util.stream.Collectors; -@@ -213,7 +214,14 @@ public abstract class PlayerList { +@@ -220,7 +221,14 @@ public abstract class PlayerList { if (bWorld != null) { resourcekey = ((CraftWorld) bWorld).getHandle().dimension(); } else { diff --git a/patches/todo/server/0020-Allow-any-username.patch b/patches/server/0013-Allow-any-username.patch similarity index 100% rename from patches/todo/server/0020-Allow-any-username.patch rename to patches/server/0013-Allow-any-username.patch diff --git a/patches/server/0014-Fix-memory-leak.patch b/patches/server/0014-Fix-memory-leak.patch new file mode 100644 index 0000000..844807b --- /dev/null +++ b/patches/server/0014-Fix-memory-leak.patch @@ -0,0 +1,29 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> +Date: Sat, 10 Jun 2023 13:06:44 +0300 +Subject: [PATCH] Fix memory leak + + +diff --git a/src/main/java/net/minecraft/world/level/biome/Biome.java b/src/main/java/net/minecraft/world/level/biome/Biome.java +index 65012a12e1430956ef55ced56773e6354ac26444..2bcd3ee3bbdf246ef429a8310ca96ba3fb4afd2c 100644 +--- a/src/main/java/net/minecraft/world/level/biome/Biome.java ++++ b/src/main/java/net/minecraft/world/level/biome/Biome.java +@@ -66,7 +66,8 @@ public final class Biome { + private final BiomeGenerationSettings generationSettings; + private final MobSpawnSettings mobSettings; + private final BiomeSpecialEffects specialEffects; +- private final ThreadLocal temperatureCache = ThreadLocal.withInitial(() -> { ++ private static final ThreadLocal temperatureCache = ThreadLocal.withInitial(() -> { // DivineMC - fix memory leak ++ + return Util.make(() -> { + Long2FloatLinkedOpenHashMap long2FloatLinkedOpenHashMap = new Long2FloatLinkedOpenHashMap(1024, 0.25F) { + protected void rehash(int i) { +@@ -118,7 +119,7 @@ public final class Biome { + @Deprecated + public float getTemperature(BlockPos blockPos) { + long l = blockPos.asLong(); +- Long2FloatLinkedOpenHashMap long2FloatLinkedOpenHashMap = this.temperatureCache.get(); ++ Long2FloatLinkedOpenHashMap long2FloatLinkedOpenHashMap = temperatureCache.get(); // DivineMC - fix memory leak + float f = long2FloatLinkedOpenHashMap.get(l); + if (!Float.isNaN(f)) { + return f; diff --git a/patches/todo/server/0021-Fix-memory-leak.patch b/patches/todo/server/0021-Fix-memory-leak.patch deleted file mode 100644 index 6600ea3..0000000 --- a/patches/todo/server/0021-Fix-memory-leak.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Tue, 4 Apr 2023 00:01:34 +0300 -Subject: [PATCH] Fix memory leak - - -diff --git a/src/main/java/net/minecraft/world/level/biome/Biome.java b/src/main/java/net/minecraft/world/level/biome/Biome.java -index ed439b7e94646141c93a7dd3704d1cdeb5c27e16..064b6340c67b0680763ed70e0d6dd51d16ed5529 100644 ---- a/src/main/java/net/minecraft/world/level/biome/Biome.java -+++ b/src/main/java/net/minecraft/world/level/biome/Biome.java -@@ -67,7 +67,7 @@ public final class Biome { - private final MobSpawnSettings mobSettings; - private final BiomeSpecialEffects specialEffects; - // Pufferfish start - use our cache -- private final ThreadLocal temperatureCache = ThreadLocal.withInitial(() -> { -+ private static final ThreadLocal temperatureCache = ThreadLocal.withInitial(() -> { // DivineMC - fix memory leak - return Util.make(() -> { - /* - Long2FloatLinkedOpenHashMap long2FloatLinkedOpenHashMap = new Long2FloatLinkedOpenHashMap(1024, 0.25F) { -@@ -125,7 +125,7 @@ public final class Biome { - public float getTemperature(BlockPos blockPos) { - long l = blockPos.asLong(); - // Pufferfish start -- gg.airplane.structs.Long2FloatAgingCache cache = this.temperatureCache.get(); -+ gg.airplane.structs.Long2FloatAgingCache cache = temperatureCache.get(); // DivineMC - fix memory leak - float f = cache.getValue(l); - if (!Float.isNaN(f)) { - return f;