Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Minecraft 1.21.4 #266

Merged
merged 11 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ org.gradle.vfs.watch=false
org.gradle.jvmargs=-Xmx1g -XX:MaxMetaspaceSize=512m -Dfile.encoding=UTF-8

group=net.okocraft.paper
version=1.21.1-R0.1-SNAPSHOT
version=1.21.4-R0.1-SNAPSHOT

mcVersion=1.21.1
mcVersion=1.21.4
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion paper-ref
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2e7bc0721af95196c85500c7bb136aeea0bc12ce
d4bc33870b263650b9a023c439fbca92f8623992
4 changes: 2 additions & 2 deletions patches/api/0001-Build-Changes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Build Changes


diff --git a/build.gradle.kts b/build.gradle.kts
index e7c96be769fde8375b9a1b128cc7ce474144d16d..bb909d35925e4d0abf023c8640cb28e5a040680b 100644
index e29e5024fa693baae469d47fe77b57118f14627c..055b559af02a2c8fa212f3b1e135b6c25d949d21 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -143,6 +143,7 @@ tasks.jar {
@@ -160,6 +160,7 @@ tasks.jar {
}

tasks.withType<Javadoc> {
Expand Down
18 changes: 9 additions & 9 deletions patches/server/0001-okocraft-customize-server.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ Subject: [PATCH] okocraft customize server


diff --git a/build.gradle.kts b/build.gradle.kts
index c2f2ba1df68e9823c56287f1bea23fb6d6a781a2..74ce6a6e46d627af819bff98006228722e770ec4 100644
index 8d2b5fec6fe27dca3ce01ba1ce50506179fc3b4d..1ed5b7a2e8cfd2fd34ffcbd0eaf5618a508461aa 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -13,7 +13,7 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
val alsoShade: Configuration by configurations.creating
@@ -25,7 +25,7 @@ abstract class MockitoAgentProvider : CommandLineArgumentProvider {
// Paper end - configure mockito agent that is needed in newer java versions

dependencies {
- implementation(project(":folia-api")) // Folia
+ implementation(project(":okocraft-api")) // Folia // okocraft
implementation("ca.spottedleaf:concurrentutil:0.0.2") // Paper - Add ConcurrentUtil dependency
// Paper start
implementation("org.jline:jline-terminal-jansi:3.21.0")
implementation("net.minecrell:terminalconsoleappender:1.3.0")
@@ -85,14 +85,14 @@ tasks.jar {
implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+
@@ -100,14 +100,14 @@ tasks.jar {
val gitBranch = git("rev-parse", "--abbrev-ref", "HEAD").getText().trim() // Paper
attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main",
Expand Down Expand Up @@ -99,11 +99,11 @@ index 0000000000000000000000000000000000000000..e6de952985b5e4f2ff2a64df948fed96
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 7948267b6b91100a2fd2dcb24817037c75f6953c..671ad5f5978d2b083c906111f3d1efddcae8655a 100644
index f546cbe867d524f402491901df7d08e56668f406..83c25c4cfba907475fe8d148c2fbe12fd321182f 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -495,7 +495,7 @@ public final class CraftMagicNumbers implements UnsafeValues {

@@ -511,7 +511,7 @@ public final class CraftMagicNumbers implements UnsafeValues {
// Paper start
@Override
public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() {
- return new com.destroystokyo.paper.PaperVersionFetcher();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ Subject: [PATCH] Fix not playing travel sound when changing the dimension by


diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 2ccc358daae43dcebf03db64526f17fbd9df23f8..ccc9e153680d0816022488e16a705e3c40b98af3 100644
index 20fe53cc8e9edfc7b7d50f23379e0044e520c84d..85e1dfe46858d6856f9e7c7e7cf380f4f69defd7 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4151,7 +4151,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4389,7 +4389,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return false;
}

Expand All @@ -18,7 +18,7 @@ index 2ccc358daae43dcebf03db64526f17fbd9df23f8..ccc9e153680d0816022488e16a705e3c
}

public boolean netherPortalLogicAsync(BlockPos portalPos) {
@@ -4163,7 +4163,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4401,7 +4401,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Subject: [PATCH] Ensure that the zombie spawn point is on the current tick


diff --git a/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java b/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java
index a2bc957bd643b90595711270ab88382c957e24b6..14901b40a251499c7d3941d527ab1c572bafb821 100644
index 326be10d31d0b546a325f4af97bb413910e79e31..957d27dea09d18ed155373f1592fa65a10f403d1 100644
--- a/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java
+++ b/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java
@@ -114,7 +114,7 @@ public class VillageSiege implements CustomSpawner {
Expand Down
12 changes: 6 additions & 6 deletions patches/server/0006-Add-custom-and-resource-worlds.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Add custom and resource worlds


diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 511992c31d70e806bba68737048ca760bef1def0..bdb0bfd2fea1204b915ec4651208cb5b302921de 100644
index be6dc4c066efd66279301f5796451105e323089a..15558624d1123cfa37a175bd4948ee0080f917d4 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -754,6 +754,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -786,6 +786,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.getCustomBossEvents().load(worlddata.getCustomBossEvents(), this.registryAccess());
}
}
Expand Down Expand Up @@ -131,10 +131,10 @@ index 0000000000000000000000000000000000000000..082ff119c1e1ee7af4a9d07100e14c01
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index dee23b4b96b7f2c6af54a6affe385b183479f8cc..b2ee52cb15333b3954b0cdb133490bec63c80a09 100644
index a8975cee866cf2c617b6d4976df71e5c20cf0e3d..13bc374acf8ef957891caac5844af294c1a82d49 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1313,6 +1313,12 @@ public final class CraftServer implements Server {
@@ -1321,6 +1321,12 @@ public final class CraftServer implements Server {
@Override
public World createWorld(WorldCreator creator) {
if (true) throw new UnsupportedOperationException(); // Folia - not implemented properly yet
Expand All @@ -147,7 +147,7 @@ index dee23b4b96b7f2c6af54a6affe385b183479f8cc..b2ee52cb15333b3954b0cdb133490bec
Preconditions.checkState(this.console.getAllLevels().iterator().hasNext(), "Cannot create additional worlds on STARTUP");
//Preconditions.checkState(!this.console.isIteratingOverLevels, "Cannot create a world while worlds are being ticked"); // Paper - Cat - Temp disable. We'll see how this goes.
Preconditions.checkArgument(creator != null, "WorldCreator cannot be null");
@@ -1472,11 +1478,25 @@ public final class CraftServer implements Server {
@@ -1480,11 +1486,25 @@ public final class CraftServer implements Server {
}

this.console.addLevel(internal); // Paper - Put world into worldlist before initing the world; move up
Expand All @@ -166,7 +166,7 @@ index dee23b4b96b7f2c6af54a6affe385b183479f8cc..b2ee52cb15333b3954b0cdb133490bec
+ if (false) // okocraft - Add custom worlds; Not needed for loading custom worlds
this.console.initWorld(internal, worlddata, worlddata, worlddata.worldGenOptions());

internal.setSpawnSettings(true, true);
internal.setSpawnSettings(true);
// Paper - Put world into worldlist before initing the world; move up

+ if (false) // okocraft - Add custom worlds; Not needed for loading custom worlds
Expand Down
2 changes: 1 addition & 1 deletion patches/server/0007-Enable-CommandBlock.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Subject: [PATCH] Enable CommandBlock
Of course, we know why the command block is disabled. Our server only executes teleport commands, so there should be no situation to access objects outside the region by the command block.

diff --git a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
index b8a571fcc44f67ac8f6089e039a8620bf6c40603..a9da8eccc2783e83bbf9618578a87eb3a6a8dc82 100644
index ccf476d1ed22cf992e3cbca6a375d36f85a82fa8..6329a84fcdbaa9037dafd70a8396888709f4e300 100644
--- a/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
+++ b/src/main/java/net/minecraft/world/level/BaseCommandBlock.java
@@ -117,7 +117,7 @@ public abstract class BaseCommandBlock implements CommandSource {
Expand Down
12 changes: 6 additions & 6 deletions patches/server/0008-Re-add-some-events.patch
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ Subject: [PATCH] Re-add some events
- PlayerChangedWorldEvent

diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index e4a68f43c1a48fe8193623c646eb40bc5f664c76..4052f44c93dcbd1f43fbe2b20191d89a0d7428ec 100644
index b6f3078fa688ca61cfd45d856b95c160cfe7b2da..2a17caec1ec82fb13463f2b6b24f5e1e0801d0d7 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1572,6 +1572,16 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
@@ -1819,6 +1819,16 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
);
}
// now the respawn logic is complete
Expand All @@ -28,7 +28,7 @@ index e4a68f43c1a48fe8193623c646eb40bc5f664c76..4052f44c93dcbd1f43fbe2b20191d89a

// last, call the function callback
if (respawnComplete != null) {
@@ -1757,6 +1767,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
@@ -2006,6 +2016,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
// Paper end - Reset shield blocking on dimension change

this.triggerDimensionChangeTriggers(originWorld);
Expand All @@ -37,7 +37,7 @@ index e4a68f43c1a48fe8193623c646eb40bc5f664c76..4052f44c93dcbd1f43fbe2b20191d89a
// finished

diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 93ceea16e436e9227bc983417b258c307156198e..645ec24737c6c0ee5b147c1097eebbb257ac87af 100644
index a809622f43a45fd77bbb07a24f21c841a90dc07a..b8c72c72af3218a37a96755e4fefe6663927715d 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -358,9 +358,10 @@ public abstract class PlayerList {
Expand All @@ -53,10 +53,10 @@ index 93ceea16e436e9227bc983417b258c307156198e..645ec24737c6c0ee5b147c1097eebbb2

player.spawnIn(worldserver1);
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index ccc9e153680d0816022488e16a705e3c40b98af3..ac30fb689e7410924208a089bc1eac06424bcbbc 100644
index 85e1dfe46858d6856f9e7c7e7cf380f4f69defd7..280a107723d72e2dbc8d719a16e5c8620d00c249 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4146,24 +4146,42 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4384,24 +4384,42 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(this, "Cannot portal entity async");

ServerLevel destination = this.getServer().getLevel(this.level().getTypeKey() == net.minecraft.world.level.dimension.LevelStem.END ? Level.OVERWORLD : Level.END);
Expand Down
14 changes: 7 additions & 7 deletions patches/server/0009-Disable-advancement-recipe-warnings.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Subject: [PATCH] Disable advancement/recipe warnings


diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
index 9fabf9322acd663c4452b562494e74aa42eb19da..c65ec58183089be9e0b6644156b20e6b5f14933f 100644
index 8e2eb7b61421ceb063654826941f1a81f6f50bdf..edc4b0849aecf653718995efe5175a6d24f7b51b 100644
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
@@ -198,7 +198,7 @@ public class PlayerAdvancements {
Expand All @@ -18,14 +18,14 @@ index 9fabf9322acd663c4452b562494e74aa42eb19da..c65ec58183089be9e0b6644156b20e6b
} else {
this.startProgress(advancementholder, advancementprogress);
diff --git a/src/main/java/net/minecraft/stats/ServerRecipeBook.java b/src/main/java/net/minecraft/stats/ServerRecipeBook.java
index 8a2584deccbf19de8a18fcfcb9c65318b60afe57..869577eb94f631059de9e6190537a666b5b77d22 100644
index 5c7484ce2850a2eb698a2183b81134b89b0bbcc7..f3486f0978ac409536b17ab92f12f12b2064422e 100644
--- a/src/main/java/net/minecraft/stats/ServerRecipeBook.java
+++ b/src/main/java/net/minecraft/stats/ServerRecipeBook.java
@@ -125,6 +125,7 @@ public class ServerRecipeBook extends RecipeBook {
Optional<RecipeHolder<?>> optional = recipeManager.byKey(minecraftkey);
@@ -159,6 +159,7 @@ public class ServerRecipeBook extends RecipeBook {
ResourceKey<Recipe<?>> resourcekey = ResourceKey.create(Registries.RECIPE, ResourceLocation.parse(s));

if (optional.isEmpty()) {
if (!validPredicate.test(resourcekey)) {
+ if (false) // okocraft - Disable recipe warnings
ServerRecipeBook.LOGGER.error("Tried to load unrecognized recipe: {} removed now.", minecraftkey);
ServerRecipeBook.LOGGER.error("Tried to load unrecognized recipe: {} removed now.", resourcekey);
} else {
handler.accept((RecipeHolder) optional.get());
handler.accept(resourcekey);
34 changes: 15 additions & 19 deletions patches/server/0010-Optimize-suffocation.patch
Original file line number Diff line number Diff line change
Expand Up @@ -17,46 +17,42 @@ but is so much cheaper than the suffocation check that it's worth
keeping it.

diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 8ccc18881d047e2b06ab3494a25f27e209931413..5e2646fa0cc234dbb219f8b780d70a8c1ae6bfae 100644
index 73af15d18180b4df3fa0614b323f2397f5543db5..db5a671ddfa462af123aee23cd2640c664587194 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -464,7 +464,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
boolean flag = this instanceof net.minecraft.world.entity.player.Player;
@@ -480,7 +480,7 @@ public abstract class LivingEntity extends Entity implements Attackable {

if (!this.level().isClientSide) {
if (world1 instanceof ServerLevel) {
worldserver1 = (ServerLevel) world1;
- if (this.isInWall()) {
+ if (this.shouldCheckForSuffocation() && this.isInWall()) { // Pufferfish - optimize suffocation
this.hurt(this.damageSources().inWall(), 1.0F);
+ if (this.shouldCheckForSuffocation(worldserver1) && this.isInWall()) { // Pufferfish - optimize suffocation
this.hurtServer(worldserver1, this.damageSources().inWall(), 1.0F);
} else if (flag && !this.level().getWorldBorder().isWithinBounds(this.getBoundingBox())) {
double d0 = this.level().getWorldBorder().getDistanceToBorder(this) + this.level().getWorldBorder().getDamageSafeZone();
@@ -1428,6 +1428,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
double d1 = this.level().getWorldBorder().getDistanceToBorder(this) + this.level().getWorldBorder().getDamageSafeZone();
@@ -1456,6 +1456,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
return this.getHealth() <= 0.0F;
}

+ // Pufferfish start - optimize suffocation
+ public boolean shouldCheckForSuffocation() {
+ return this.tickCount % 10 == 0 && this.couldPossiblyBeHurt(1.0F);
+ }
+
+ public boolean couldPossiblyBeHurt(float amount) {
+ return !((float) this.invulnerableTime > (float) this.invulnerableDuration / 2.0F) || !(amount <= this.lastHurt);
+ public boolean shouldCheckForSuffocation(ServerLevel world) {
+ return this.tickCount % 10 == 0 && !this.isInvulnerableTo(world, this.damageSources().inWall());
+ }
+ // Pufferfish end - optimize suffocation
+
@Override
public boolean hurt(DamageSource source, float amount) {
if (this.isInvulnerableTo(source)) {
public boolean hurtServer(ServerLevel world, DamageSource source, float amount) {
if (this.isInvulnerableTo(world, source)) {
diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
index d3b4d492aee380dc17f4232d90eaae4f07bb9f86..042d661aef88d0e3babad971b86ec64bc7818fbd 100644
index bd9e10f79eaf0d23908229b3ebc2227946a14843..243cbb6a13954373e485cc017edf2b5f3f2d9c39 100644
--- a/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
@@ -154,6 +154,13 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
@@ -151,6 +151,13 @@ public class WitherBoss extends Monster implements RangedAttackMob {
this.bossEvent.setName(this.getDisplayName());
}

+ // Pufferfish start - optimize suffocation
+ @Override
+ public boolean shouldCheckForSuffocation() {
+ public boolean shouldCheckForSuffocation(ServerLevel world) {
+ return true;
+ }
+ // Pufferfish end - optimize suffocation
Expand Down
Loading
Loading