diff --git a/build.gradle.kts b/build.gradle.kts index 3ca8459..afbd016 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,7 +3,7 @@ import io.papermc.paperweight.util.constants.PAPERCLIP_CONFIG plugins { java id("com.github.johnrengelman.shadow") version "8.1.1" apply false - id("io.papermc.paperweight.patcher") version "1.5.10" + id("io.papermc.paperweight.patcher") version "1.5.11" } repositories { diff --git a/gradle.properties b/gradle.properties index 795379c..8f78150 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ group=me.samsuik.sakura version=1.20.4-R0.1-SNAPSHOT mcVersion=1.20.4 -paperRef=930a24f965d02250fa58436c019a4d5eb7e5f607 +paperRef=bcbe5dcd78e5de030c9b99e82bd4d47b6a7fa026 org.gradle.jvmargs=-Xmx2G diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index ccebba7..7f93135 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 744c64d..1af9e09 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 79a61d4..1aa94a4 100755 --- a/gradlew +++ b/gradlew @@ -83,10 +83,8 @@ done # This is normally unused # shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -133,10 +131,13 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. @@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -197,11 +198,15 @@ if "$cygwin" || "$msys" ; then done fi -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/patches/server/0006-Visibility-API-and-Command.patch b/patches/server/0006-Visibility-API-and-Command.patch index 71c2742..efe029d 100644 --- a/patches/server/0006-Visibility-API-and-Command.patch +++ b/patches/server/0006-Visibility-API-and-Command.patch @@ -391,7 +391,7 @@ index 35674f92a67f93382103c2766df4b678ba5c862f..83c4639c2bdca4dc4281d9f5eca104af if (this.entity instanceof LivingEntity) { diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 03fcd3d24b18745c3ddbc20edbb06b92417db341..fdff4d661143b31d0331824c7df0978dfeece930 100644 +index 1f36015d2e9c433cfe2de079b8eba144f0dad4cf..c33c9cb3a0e574e5284e48ffaf8d0945061ea388 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -1956,7 +1956,7 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -446,7 +446,7 @@ index 8efbbd379244e3ed54d4aba199037cc20ccd096a..3ef738c817c10a9233b930296ce5df6e } diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -index 77cd2b73e4d499beca16962a6b3d1fefe279cd87..79f02204a800ddd3a4e32a34aaa1636d97ccba04 100644 +index 4a712f5fc4f0b4a4434ae808c989113bee8d8634..c59db7ea7d4dafc6df030c2c4d5f51395fe1c363 100644 --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java @@ -40,6 +40,23 @@ import org.bukkit.craftbukkit.util.Waitable; @@ -549,10 +549,10 @@ index 77cd2b73e4d499beca16962a6b3d1fefe279cd87..79f02204a800ddd3a4e32a34aaa1636d throw new ReportedException(crashreport); } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 9a94249834f8b0b8d3f6aeaf0c859ba875079250..3a5657fe93f8f63cbebfd005db0848c221c2a9c2 100644 +index 30ccbab1586a656e0ae41d7406525fb02d9e025b..187ba90c50256aaa0514f4b2bd79bf30bc04b0af 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3113,6 +3113,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3107,6 +3107,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl event.setCancelled(cancelled); AbstractContainerMenu oldContainer = this.player.containerMenu; // SPIGOT-1224 @@ -611,10 +611,10 @@ index 512088b5457e5afbc29d2937051fc4dcc4c5aed6..8fd4d63fdbff9c454d903f4797ec9281 this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index ed41decbf0522c516b3608569d5719687105e25b..3ec169d2ead17d1229c6db1fb2ba05ab91ecba73 100644 +index fd84786f3e72875e79df46416f47f3403876cef3..044033eb34581849ecb0463164ca05bf19466c76 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -501,6 +501,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -497,6 +497,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { this.getHandle().displayName = name == null ? this.getName() : name; } diff --git a/patches/server/0020-Optimised-Explosions.patch b/patches/server/0020-Optimised-Explosions.patch index e0262dd..e7d288d 100644 --- a/patches/server/0020-Optimised-Explosions.patch +++ b/patches/server/0020-Optimised-Explosions.patch @@ -142,7 +142,7 @@ index 0000000000000000000000000000000000000000..3f6f34cc617efaad420485a7f613cfca +} diff --git a/src/main/java/me/samsuik/sakura/explosion/SakuraExplosion.java b/src/main/java/me/samsuik/sakura/explosion/SakuraExplosion.java new file mode 100644 -index 0000000000000000000000000000000000000000..90540b3c8c695e24419b0e0460f0c42f949142b0 +index 0000000000000000000000000000000000000000..4f9880d35347dd008aa2ee6e67f35301ff37a4c0 --- /dev/null +++ b/src/main/java/me/samsuik/sakura/explosion/SakuraExplosion.java @@ -0,0 +1,391 @@ @@ -495,12 +495,12 @@ index 0000000000000000000000000000000000000000..90540b3c8c695e24419b0e0460f0c42f + // Calculate damage separately for each EntityComplexPart + if (ent == null) break; + if (ent == entityComplexPart) { -+ entityComplexPart.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity, getSeenFraction(pos, entityComplexPart, null, blockCache, blockPos))); // Sakura // Paper - actually optimise explosions ++ entityComplexPart.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entityComplexPart, getSeenFraction(pos, entityComplexPart, null, blockCache, blockPos))); // Sakura // Paper - actually optimise explosions and use the right entity to calculate the damage + } + } + } + } else { -+ entity.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity)); ++ entity.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity, getSeenFraction(pos, entity, null, blockCache, blockPos))); // Sakura // Paper - actually optimise explosions + } + + CraftEventFactory.entityDamage = null; @@ -620,7 +620,7 @@ index d131a64fe26e5ba33ccb1361c015795984fde85a..fa6da05e6d33f74bbae986c6b4db3077 this.isIteratingOverLevels = false; // Paper diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index cccdce1e317e049b0cdb45a66c7f0d2853f00216..ec193e89ac948795e5fb1f6303684df08380ffec 100644 +index a507605a04af7f576548129517029192309fd9e7..65fe46780a9f9687d328afb5cca176ab4da23318 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java @@ -1961,6 +1961,12 @@ public class ServerLevel extends Level implements WorldGenLevel { @@ -666,7 +666,7 @@ index 826a910a02ae234012d10bb9ca3b677d127a6d13..2445bfc0c5604cb0185d240c9448a5c7 @Override diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java -index 9fdfc43ea51a326444a04d79976d315aa64050d1..4d052ef2b6d3ebd399e1904d67e973969efc683d 100644 +index 3d4a75302d72bdbe47d0efbe08c89401dbe22a87..fdc0a863aaf6fee90cea28966009088a9926cb1b 100644 --- a/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java @@ -55,14 +55,16 @@ public class Explosion { @@ -904,15 +904,20 @@ index 9fdfc43ea51a326444a04d79976d315aa64050d1..4d052ef2b6d3ebd399e1904d67e97396 int l = Mth.floor(this.y - (double) f2 - 1.0D); int i1 = Mth.floor(this.y + (double) f2 + 1.0D); int j1 = Mth.floor(this.z - (double) f2 - 1.0D); -@@ -591,7 +686,7 @@ public class Explosion { +@@ -591,11 +686,11 @@ public class Explosion { for (EnderDragonPart entityComplexPart : ((EnderDragon) entity).subEntities) { // Calculate damage separately for each EntityComplexPart if (list.contains(entityComplexPart)) { -- entityComplexPart.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity, getSeenFraction(vec3d, entityComplexPart, blockCache, blockPos))); // Paper - actually optimise explosions -+ entityComplexPart.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity, getSeenFraction(vec3d, entityComplexPart, null, blockCache, blockPos))); // Sakura // Paper - actually optimise explosions +- entityComplexPart.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entityComplexPart, getSeenFraction(vec3d, entityComplexPart, blockCache, blockPos))); // Paper - actually optimise explosions and use the right entity to calculate the damage ++ entityComplexPart.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entityComplexPart, getSeenFraction(vec3d, entityComplexPart, null, blockCache, blockPos))); // Sakura // Paper - actually optimise explosions and use the right entity to calculate the damage } } } else { +- entity.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity, getSeenFraction(vec3d, entity, blockCache, blockPos))); // Paper - actually optimise explosions ++ entity.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity, getSeenFraction(vec3d, entity, null, blockCache, blockPos))); // Sakura // Paper - actually optimise explosions + } + + CraftEventFactory.entityDamage = null; @@ -635,9 +730,7 @@ public class Explosion { } } @@ -969,11 +974,11 @@ index 9fdfc43ea51a326444a04d79976d315aa64050d1..4d052ef2b6d3ebd399e1904d67e97396 return blockDensity; diff --git a/src/main/java/net/minecraft/world/level/ExplosionDamageCalculator.java b/src/main/java/net/minecraft/world/level/ExplosionDamageCalculator.java -index 67625a34084792f6cbab34bf99e5571bb75e59d9..806c0213791ba94a6da121b83921064b0480643b 100644 +index f529f5d0f28533ec89f3ee712e59745991d068ee..d0ff7710577c1cfedae494796e6db420fef2bd08 100644 --- a/src/main/java/net/minecraft/world/level/ExplosionDamageCalculator.java +++ b/src/main/java/net/minecraft/world/level/ExplosionDamageCalculator.java -@@ -22,7 +22,7 @@ public class ExplosionDamageCalculator { - +@@ -23,7 +23,7 @@ public class ExplosionDamageCalculator { + @io.papermc.paper.annotation.DoNotUse @Deprecated // Paper public float getEntityDamageAmount(Explosion explosion, Entity entity) { // Paper start - actually optimise explosions - return this.getEntityDamageAmount(explosion, entity, Explosion.getSeenPercent(explosion.center(), entity)); diff --git a/scripts/apatch.sh b/scripts/apatch.sh old mode 100644 new mode 100755 diff --git a/scripts/upstream.sh b/scripts/upstream.sh old mode 100644 new mode 100755 diff --git a/scripts/upstreamCommit.sh b/scripts/upstreamCommit.sh old mode 100644 new mode 100755