Skip to content

Commit

Permalink
Updated Upstream (Paper/Gale/Purpur)
Browse files Browse the repository at this point in the history
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@227544c Move TickThread changes from Moonrise patch to MCUtils
PaperMC/Paper@67d414a Allow plugin aliases to override vanilla commands (#11186)
PaperMC/Paper@58c7ea3 Preserve command node when re-registering modern commands through old API (#11184)
PaperMC/Paper@0a1be9a Make loadChunksForMoveAsync use new chunk system load calls

Gale Changes:
Dreeam-qwq/Gale@8abe7b6 Updated Upstream (Paper)

Purpur Changes:
PurpurMC/Purpur@0bd5579 Updated Upstream (Paper)
  • Loading branch information
Dreeam-qwq committed Jul 31, 2024
1 parent 242637a commit 801a2bf
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 57 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ group = cn.dreeam.leaf
mcVersion = 1.21
version = 1.21-R0.1-SNAPSHOT

galeCommit = ed44787067c48e3eb4e8014db454fd050e54fb46
galeCommit = 8abe7b6d109b3d171a0cc660f19bfa383c324d92

org.gradle.caching = true
org.gradle.parallel = true
Expand Down
2 changes: 1 addition & 1 deletion patches/api/0004-Purpur-API-Changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Subject: [PATCH] Purpur API Changes
Original license: MIT
Original project: https://github.com/PurpurMC/Purpur

Commit: 72ccfbd343bd2af2df3456d43aa737d6cfe849db
Commit: 0bd557933cb015dfb3f0ac91974019631101f1d6

Patches below are removed in this patch:
Pufferfish-API-Changes.patch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Subject: [PATCH] Purpur generated-api Changes
Original license: MIT
Original project: https://github.com/PurpurMC/Purpur

Commit: 72ccfbd343bd2af2df3456d43aa737d6cfe849db
Commit: 0bd557933cb015dfb3f0ac91974019631101f1d6

diff --git a/com/destroystokyo/paper/entity/ai/VanillaGoal.java b/com/destroystokyo/paper/entity/ai/VanillaGoal.java
index 3add91218dd3f07052aa932f0503d1f10ac3799b..3e41a4141095bce989c75e989293deb3f47e8e6d 100644
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 7e94dcbf3adb8954800a6d577b39616638d673e8..4c95cb6a53004157faac55540225da3e4f8eb82b 100644
index b5491374f17c93310cba14a29ade7f416dd68ab4..d0b8099b8ce299c44bbde9b8dd34ccd9312579e8 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -744,6 +744,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -701,6 +701,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
org.spigotmc.ActivationRange.activateEntities(this); // Spigot
this.timings.entityTick.startTiming(); // Spigot
this.entityTickList.forEach((entity) -> {
Expand Down
39 changes: 21 additions & 18 deletions patches/server/0010-Purpur-Server-Changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ TODO - Dreeam: Check Fix-pufferfish-issues.patch
Original license: MIT
Original project: https://github.com/PurpurMC/Purpur

Commit: 72ccfbd343bd2af2df3456d43aa737d6cfe849db
Commit: 0bd557933cb015dfb3f0ac91974019631101f1d6

Patches below are removed in this patch:
Brand changes in Rebrand.patch
Expand Down Expand Up @@ -970,7 +970,7 @@ index c80be65d190c85e7f0ea8233ebbbdbc1ea67f276..97e793c971614299504605aeb4f99cad
public ServerEntity(ServerLevel worldserver, Entity entity, int i, boolean flag, Consumer<Packet<?>> consumer, Set<ServerPlayerConnection> trackedPlayers) {
this.trackedPlayers = trackedPlayers;
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 4c95cb6a53004157faac55540225da3e4f8eb82b..e3152dd90c5c58a8f40491fa3250f7e38c2eaa8b 100644
index d0b8099b8ce299c44bbde9b8dd34ccd9312579e8..3a816a31b9f3ecb02291b8be897db828502eab84 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -220,6 +220,8 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
Expand All @@ -990,7 +990,7 @@ index 4c95cb6a53004157faac55540225da3e4f8eb82b..e3152dd90c5c58a8f40491fa3250f7e3

public LevelChunk getChunkIfLoaded(int x, int z) {
return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately
@@ -563,7 +566,24 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -520,7 +523,24 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
this.dragonParts = new Int2ObjectOpenHashMap();
this.tickTime = flag1;
this.server = minecraftserver;
Expand All @@ -1016,15 +1016,15 @@ index 4c95cb6a53004157faac55540225da3e4f8eb82b..e3152dd90c5c58a8f40491fa3250f7e3
this.serverLevelData = iworlddataserver;
ChunkGenerator chunkgenerator = worlddimension.generator();
// CraftBukkit start
@@ -634,6 +654,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -591,6 +611,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
this.chunkTaskScheduler = new ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkTaskScheduler((ServerLevel)(Object)this, ca.spottedleaf.moonrise.common.util.MoonriseCommon.WORKER_POOL);
// Paper end - rewrite chunk system
this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
+ this.preciseTime = this.serverLevelData.getDayTime(); // Purpur
}

// Paper start
@@ -680,7 +701,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -637,7 +658,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
long j;

Expand All @@ -1033,7 +1033,7 @@ index 4c95cb6a53004157faac55540225da3e4f8eb82b..e3152dd90c5c58a8f40491fa3250f7e3
// CraftBukkit start
j = this.levelData.getDayTime() + 24000L;
TimeSkipEvent event = new TimeSkipEvent(this.getWorld(), TimeSkipEvent.SkipReason.NIGHT_SKIP, (j - j % 24000L) - this.getDayTime());
@@ -802,6 +823,13 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -759,6 +780,13 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
this.serverLevelData.setGameTime(i);
this.serverLevelData.getScheduledEvents().tick(this.server, i);
if (this.levelData.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) {
Expand All @@ -1047,7 +1047,7 @@ index 4c95cb6a53004157faac55540225da3e4f8eb82b..e3152dd90c5c58a8f40491fa3250f7e3
this.setDayTime(this.levelData.getDayTime() + 1L);
}

@@ -810,8 +838,22 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -767,8 +795,22 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.

public void setDayTime(long timeOfDay) {
this.serverLevelData.setDayTime(timeOfDay);
Expand All @@ -1070,7 +1070,7 @@ index 4c95cb6a53004157faac55540225da3e4f8eb82b..e3152dd90c5c58a8f40491fa3250f7e3
public void tickCustomSpawners(boolean spawnMonsters, boolean spawnAnimals) {
Iterator iterator = this.customSpawners.iterator();

@@ -905,10 +947,18 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -862,10 +904,18 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
boolean flag1 = this.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && this.random.nextDouble() < (double) difficultydamagescaler.getEffectiveDifficulty() * this.paperConfig().entities.spawning.skeletonHorseThunderSpawnChance.or(0.01D) && !this.getBlockState(blockposition.below()).is(Blocks.LIGHTNING_ROD); // Paper - Configurable spawn chances for skeleton horses

if (flag1) {
Expand All @@ -1091,7 +1091,7 @@ index 4c95cb6a53004157faac55540225da3e4f8eb82b..e3152dd90c5c58a8f40491fa3250f7e3
entityhorseskeleton.setAge(0);
entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
this.addFreshEntity(entityhorseskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); // CraftBukkit
@@ -987,7 +1037,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -944,7 +994,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
return holder.is(PoiTypes.LIGHTNING_ROD);
}, (blockposition1) -> {
return blockposition1.getY() == this.getHeight(Heightmap.Types.WORLD_SURFACE, blockposition1.getX(), blockposition1.getZ()) - 1;
Expand All @@ -1100,7 +1100,7 @@ index 4c95cb6a53004157faac55540225da3e4f8eb82b..e3152dd90c5c58a8f40491fa3250f7e3

return optional.map((blockposition1) -> {
return blockposition1.above(1);
@@ -1036,11 +1086,27 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -993,11 +1043,27 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
if (this.canSleepThroughNights()) {
if (!this.getServer().isSingleplayer() || this.getServer().isPublished()) {
int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
Expand Down Expand Up @@ -1129,23 +1129,23 @@ index 4c95cb6a53004157faac55540225da3e4f8eb82b..e3152dd90c5c58a8f40491fa3250f7e3
ichatmutablecomponent = Component.translatable("sleep.players_sleeping", this.sleepStatus.amountSleeping(), this.sleepStatus.sleepersNeeded(i));
}

@@ -1180,6 +1246,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -1137,6 +1203,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@VisibleForTesting
public void resetWeatherCycle() {
// CraftBukkit start
+ if (this.purpurConfig.rainStopsAfterSleep) // Purpur
this.serverLevelData.setRaining(false, org.bukkit.event.weather.WeatherChangeEvent.Cause.SLEEP); // Paper - Add cause to Weather/ThunderChangeEvents
// If we stop due to everyone sleeping we should reset the weather duration to some other random value.
// Not that everyone ever manages to get the whole server to sleep at the same time....
@@ -1187,6 +1254,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -1144,6 +1211,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
this.serverLevelData.setRainTime(0);
}
// CraftBukkit end
+ if (this.purpurConfig.thunderStopsAfterSleep) // Purpur
this.serverLevelData.setThundering(false, org.bukkit.event.weather.ThunderChangeEvent.Cause.SLEEP); // Paper - Add cause to Weather/ThunderChangeEvents
// CraftBukkit start
// If we stop due to everyone sleeping we should reset the weather duration to some other random value.
@@ -2625,7 +2693,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -2582,7 +2650,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
// Spigot Start
if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder && (!(entity instanceof ServerPlayer) || entity.getRemovalReason() != Entity.RemovalReason.KILLED)) { // SPIGOT-6876: closeInventory clears death message
// Paper start - Fix merchant inventory not closing on entity removal
Expand Down Expand Up @@ -22438,14 +22438,15 @@ index 0000000000000000000000000000000000000000..9383c07fa53141127106a1f289366a04
+}
diff --git a/src/main/java/org/purpurmc/purpur/controller/LookControllerWASD.java b/src/main/java/org/purpurmc/purpur/controller/LookControllerWASD.java
new file mode 100644
index 0000000000000000000000000000000000000000..b8c25c96e95dd5ec3ad9fa4c41bd6c08e144832d
index 0000000000000000000000000000000000000000..132fd4e3206a0791f0fed96145e22050ab90161f
--- /dev/null
+++ b/src/main/java/org/purpurmc/purpur/controller/LookControllerWASD.java
@@ -0,0 +1,76 @@
@@ -0,0 +1,79 @@
+package org.purpurmc.purpur.controller;
+
+
+import net.minecraft.network.protocol.game.ClientboundMoveEntityPacket;
+import net.minecraft.server.level.ServerLevel;
+import net.minecraft.util.Mth;
+import net.minecraft.world.entity.Mob;
+import net.minecraft.world.entity.ai.control.LookControl;
Expand Down Expand Up @@ -22486,12 +22487,14 @@ index 0000000000000000000000000000000000000000..b8c25c96e95dd5ec3ad9fa4c41bd6c08
+ entity.xRotO = entity.getXRot();
+ entity.yRotO = entity.getYRot();
+
+ entity.tracker.broadcast(new ClientboundMoveEntityPacket
+ .PosRot(entity.getId(),
+ ClientboundMoveEntityPacket.PosRot entityPacket = new ClientboundMoveEntityPacket.PosRot(
+ entity.getId(),
+ (short) 0, (short) 0, (short) 0,
+ (byte) Mth.floor(entity.getYRot() * 256.0F / 360.0F),
+ (byte) Mth.floor(entity.getXRot() * 256.0F / 360.0F),
+ entity.onGround));
+ entity.onGround
+ );
+ ((ServerLevel) entity.level()).getChunkSource().broadcast(entity, entityPacket);
+ }
+
+ public void setOffsets(float yaw, float pitch) {
Expand Down
21 changes: 2 additions & 19 deletions patches/server/0011-Fix-Pufferfish-and-Purpur-patches.patch
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ index 1e7350b3199b1f1b9935c1893e61f41c4cc0d999..8fded112c6c30070ee6514ef25f1bad1
// Gale end - MultiPaper - skip unnecessary mob spawning computations

diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index e3152dd90c5c58a8f40491fa3250f7e38c2eaa8b..ac323393d7fe0b77bafb0728b7eb545930136e6e 100644
index 3a816a31b9f3ecb02291b8be897db828502eab84..1b759f7ce1d1244982d8eac8b9bce95668e1bb8f 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -701,7 +701,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
@@ -658,7 +658,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
int i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
long j;

Expand Down Expand Up @@ -322,20 +322,3 @@ index 75af21644eaf78abdebd722b671f3c47aa083a25..c55757f0a24a0b5c06333070f5875e7d
+ return text("Previous: " + oldVersion, NamedTextColor.GRAY, TextDecoration.ITALIC); // Purpur
}
}
diff --git a/src/main/java/org/purpurmc/purpur/controller/LookControllerWASD.java b/src/main/java/org/purpurmc/purpur/controller/LookControllerWASD.java
index b8c25c96e95dd5ec3ad9fa4c41bd6c08e144832d..2f7332b94940e7c05c5e9f82ffda0bc8398717d7 100644
--- a/src/main/java/org/purpurmc/purpur/controller/LookControllerWASD.java
+++ b/src/main/java/org/purpurmc/purpur/controller/LookControllerWASD.java
@@ -42,7 +42,11 @@ public class LookControllerWASD extends LookControl {
entity.xRotO = entity.getXRot();
entity.yRotO = entity.getYRot();

- entity.tracker.broadcast(new ClientboundMoveEntityPacket
+ // Leaf start - Fix
+ net.minecraft.server.level.ServerLevel world = (net.minecraft.server.level.ServerLevel) this.entity.level();
+ net.minecraft.server.level.ChunkMap.TrackedEntity tracker = world == null ? null : world.getChunkSource().chunkMap.entityMap.get(this.entity.getId());
+ tracker.broadcast(new ClientboundMoveEntityPacket
+ // Leaf end - Fix
.PosRot(entity.getId(),
(short) 0, (short) 0, (short) 0,
(byte) Mth.floor(entity.getYRot() * 256.0F / 360.0F),
Loading

0 comments on commit 801a2bf

Please sign in to comment.