Updated Upstream (Folia)

Latest 1.20.4 Paper/Folia
This commit is contained in:
Dreeam
2024-05-09 16:58:15 -04:00
parent 1e5e540795
commit b027e4cd03
26 changed files with 152 additions and 159 deletions

View File

@@ -2,7 +2,7 @@ plugins {
java
`maven-publish`
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
id("io.papermc.paperweight.patcher") version "1.5.12"
id("io.papermc.paperweight.patcher") version "1.5.15"
}
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
@@ -16,7 +16,7 @@ repositories {
dependencies {
remapper("net.fabricmc:tiny-remapper:0.10.1:fat")
decompiler("net.minecraftforge:forgeflower:2.0.627.2")
decompiler("org.vineflower:vineflower:1.10.1")
paperclip("io.papermc:paperclip:3.0.3")
}
@@ -75,7 +75,7 @@ paperweight {
decompileRepo.set("https://maven.quiltmc.org/")
useStandardUpstream("folia") {
url.set(github("PaperMC", "Folia"))
url.set(github("Dreeam-qwq", "Folia"))
ref.set(providers.gradleProperty("foliaCommit"))
withStandardPatcher {

View File

@@ -1,7 +1,7 @@
group = me.earthme.luminol
version = 1.20.4-R0.1-SNAPSHOT
foliaCommit = 25ee657a8290530812f5f93f62d48df541a02ccf
foliaCommit = 6dba62e72c05cd71da3a99da09f3d8879a508ac3
org.gradle.caching = true
org.gradle.parallel = true

Binary file not shown.

View File

@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

29
gradlew vendored
View File

@@ -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" \

20
gradlew.bat vendored
View File

@@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
@@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail

View File

@@ -16,10 +16,10 @@ index d547ae2b20c58bc703de4532b3b591dd34ddb1c6..8721954514f813d0a1200935e27a3ac0
+ long getChunkHotAvg(); // KioCG
}
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index c6cb4f17469a8f2e60dd3e28d41402851ce5fb21..9800a173bfe0ab4a43e1f851c334ea121c5b9967 100644
index d048ae07cc33fd77d128cc1ebf88b0804969fa3c..7e633b448327ee01533a00bc278367c47951d3e2 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -3711,4 +3711,6 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -3752,4 +3752,6 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@Override
Spigot spigot();
// Spigot end

View File

@@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..1e03e51e51f56c38abaad100274e25c9
+ }
+}
diff --git a/src/main/java/net/minecraft/commands/arguments/ArgumentSignatures.java b/src/main/java/net/minecraft/commands/arguments/ArgumentSignatures.java
index 72a8aa676836fcb3b4578689d16af65e18f55bbe..9408747cb254a99d5cb3fc26fde16ddb80168894 100644
index 4abd7babc3aa7268975386e7c2319f7961b0c3aa..d209466866c30b3f15b8c40934ea6470292b8a77 100644
--- a/src/main/java/net/minecraft/commands/arguments/ArgumentSignatures.java
+++ b/src/main/java/net/minecraft/commands/arguments/ArgumentSignatures.java
@@ -14,9 +14,17 @@ public record ArgumentSignatures(List<ArgumentSignatures.Entry> entries) {
@@ -52,7 +52,7 @@ index 72a8aa676836fcb3b4578689d16af65e18f55bbe..9408747cb254a99d5cb3fc26fde16ddb
+
@Nullable
public MessageSignature get(String argumentName) {
for(ArgumentSignatures.Entry entry : this.entries) {
for (ArgumentSignatures.Entry entry : this.entries) {
diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
index b863249ff7e13cf4939c8961601f0564c62fd661..6ab73b0568c3f9df8090be992736a14d49e0286c 100644
--- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java

View File

@@ -371,10 +371,10 @@ index 9d7837f90340a96edbd544826ae2241c61ae72c4..c8701a2a0a3cbd60e263fe5c069b5993
public io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances getViewDistances() {
return this.viewDistances.get();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index b0a70287ff1fc9b3d5eba322d949aaf510b165d2..74e7fefe0819829f9280cf1602cca841f796e7a3 100644
index 0ece776a1e281a328e28dc07fb4dc882b19d029c..b57980d4fa445f2aa71e4477459da833eade50e8 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2285,6 +2285,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2287,6 +2287,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
handle.expToDrop = data.getInt("expToDrop");
handle.keepLevel = data.getBoolean("keepLevel");
}
@@ -384,7 +384,7 @@ index b0a70287ff1fc9b3d5eba322d949aaf510b165d2..74e7fefe0819829f9280cf1602cca841
}
}
@@ -2306,6 +2309,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2308,6 +2311,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
data.putLong("lastPlayed", System.currentTimeMillis());
data.putString("lastKnownName", handle.getScoreboardName());

View File

@@ -31,10 +31,10 @@ index 0000000000000000000000000000000000000000..83176a8a7e993b51a0663b0f76161884
+ }
+}
diff --git a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
index ba12919c3f9aec34a9e64993b143ae92be5eb172..ba983d557ae16b3fbb7d0ea6ff67666a809d2e99 100644
index 0af9ed92824ccf30814eceb6a2c2e5c12661c991..7c42f0ca1f3abe38dcd97b0985c72332b45761f7 100644
--- a/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
+++ b/src/main/java/net/minecraft/network/chat/SignedMessageChain.java
@@ -38,7 +38,7 @@ public class SignedMessageChain {
@@ -37,7 +37,7 @@ public class SignedMessageChain {
throw new SignedMessageChain.DecodeException(Component.translatable("chat.disabled.chain_broken"), false); // Paper - diff on change (if disconnects, need a new kick event cause)
} else if (playerPublicKey.data().hasExpired()) {
throw new SignedMessageChain.DecodeException(Component.translatable("chat.disabled.expiredProfileKey"), false, org.bukkit.event.player.PlayerKickEvent.Cause.EXPIRED_PROFILE_PUBLIC_KEY); // Paper - kick event causes

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Kaiiju Don't pathfind outside region
diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/MoveToTargetSink.java b/src/main/java/net/minecraft/world/entity/ai/behavior/MoveToTargetSink.java
index 1ab77f3518d1df30f66ae44d7d4fa69e5b32d93a..98bf17441da3169d49de55fe89d79ebe250a2b7e 100644
index 2a7a26ca447cc78f24e61a2bf557411c31eb16b2..28602455d659dfac4653ab5b7bf4139f65c190ad 100644
--- a/src/main/java/net/minecraft/world/entity/ai/behavior/MoveToTargetSink.java
+++ b/src/main/java/net/minecraft/world/entity/ai/behavior/MoveToTargetSink.java
@@ -107,7 +107,9 @@ public class MoveToTargetSink extends Behavior<Mob> {
@@ -120,7 +120,9 @@ public class MoveToTargetSink extends Behavior<Mob> {
private boolean tryComputePath(Mob entity, WalkTarget walkTarget, long time) {
BlockPos blockPos = walkTarget.getTarget().currentBlockPosition();

View File

@@ -5,15 +5,15 @@ Subject: [PATCH] Pufferfish Early return optimization for target finding
diff --git a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java
index c8a80c1b2fedff22e8a877d466062375ffb2f0d7..3c4f4af85a3f2d4f9f52827164e63727b916c33a 100644
index d2f0c3b26d4beedb49d86e0242d843590d469d02..c55fe31f3fc1c9ccb949c6bfb64e1bd6f37b8356 100644
--- a/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java
+++ b/src/main/java/net/minecraft/world/entity/ai/targeting/TargetingConditions.java
@@ -75,9 +75,18 @@ public class TargetingConditions {
@@ -76,9 +76,18 @@ public class TargetingConditions {
}
if (this.range > 0.0D) {
- double d = this.testInvisible ? targetEntity.getVisibilityPercent(baseEntity) : 1.0D;
- double e = Math.max((this.useFollowRange ? this.getFollowRange(baseEntity) : this.range) * d, 2.0D); // Paper - Fix MC-145656
if (this.range > 0.0) {
- double d = this.testInvisible ? targetEntity.getVisibilityPercent(baseEntity) : 1.0;
- double e = Math.max((this.useFollowRange ? this.getFollowRange(baseEntity) : this.range) * d, 2.0); // Paper - Fix MC-145656
+ // Pufferfish start - check range before getting visibility
+ // d = invisibility percent, e = follow range adjusted for invisibility, f = distance
double f = baseEntity.distanceToSqr(targetEntity.getX(), targetEntity.getY(), targetEntity.getZ());
@@ -23,8 +23,8 @@ index c8a80c1b2fedff22e8a877d466062375ffb2f0d7..3c4f4af85a3f2d4f9f52827164e63727
+ return false;
+ }
+
+ double d = this.testInvisible ? targetEntity.getVisibilityPercent(baseEntity) : 1.0D;
+ double e = Math.max((followRangeRaw) * d, 2.0D); // Paper
+ double d = this.testInvisible ? targetEntity.getVisibilityPercent(baseEntity) : 1.0;
+ double e = Math.max((followRangeRaw) * d, 2.0D); // Paper - Fix MC-145656
+ // Pufferfish end
if (f > e * e) {
return false;

View File

@@ -5,12 +5,12 @@ Subject: [PATCH] Pufferfish Fix Paper#6045, block goal shouldn't load chunks
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
index 07519c817cc6de04a98198c43a0c2b02ba3141eb..ee66be6e5aa45ec8448b6d30785a6e71200b09e3 100644
index aee0147649d458b87d92496eda0c1723ebe570d2..89e9ea999d2fbd81a1d74382ef3fcd675fc8b94e 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
@@ -120,6 +120,7 @@ public abstract class MoveToBlockGoal extends Goal {
for(int m = 0; m <= l; m = m > 0 ? -m : 1 - m) {
for(int n = m < l && m > -l ? l : 0; n <= l; n = n > 0 ? -n : 1 - n) {
@@ -121,6 +121,7 @@ public abstract class MoveToBlockGoal extends Goal {
for (int m = 0; m <= l; m = m > 0 ? -m : 1 - m) {
for (int n = m < l && m > -l ? l : 0; n <= l; n = n > 0 ? -n : 1 - n) {
mutableBlockPos.setWithOffset(blockPos, m, k - 1, n);
+ if (!this.mob.level().hasChunkAt(mutableBlockPos)) continue; // Pufferfish - if this block isn't loaded, continue
if (this.mob.isWithinRestriction(mutableBlockPos) && this.isValidTarget(this.mob.level(), mutableBlockPos)) {

View File

@@ -83,7 +83,7 @@ index 43b8f64d7c14e6dd0975b24a3205806c4433f26f..3f394934e64df09e65b86d61a1dcabd3
if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed
entity.discard();
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 835a6e73a340375e30e4822df45a1c99d36ac009..c7c0f6e399e472792ecad75fc402a64785fae818 100644
index 5c36b3c6bf38acfa3f38dcca4b666aca9665e7d4..5b76c645214852f172c2a498751438090cc970ec 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -481,6 +481,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -111,7 +111,7 @@ index 8deae3e95a26f4b42b2c2134e22f9649bd7a5391..c09357c1ef84a29d972119cb496b0ae9
private String descriptionId;
@Nullable
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 7369d608c26e46e9d3a881ac14efe1d0f075b1cb..7f6b810f175e21dbbc85d17fefbba2a7c638144d 100644
index 7433a29577ecb36e847bd610059c0c83702d01f6..397c8ef1c83f0bf3c03d31ee19dbf1533dba9e48 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -234,10 +234,10 @@ public abstract class Mob extends LivingEntity implements Targeting {
@@ -149,10 +149,10 @@ index 7369d608c26e46e9d3a881ac14efe1d0f075b1cb..7f6b810f175e21dbbc85d17fefbba2a7
this.level().getProfiler().pop();
}
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
index 676f5485a4ca9252e911213dcda8d51776b637b6..0f53c206b4c0607e2cda5cfa4edeae5209e897bf 100644
index 38af5c7280366fd6ec077f3d914ea5f3ee77451a..f97b41422949bc6521b289daa6ca2861f25885a0 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
@@ -53,9 +53,12 @@ public class GoalSelector {
@@ -52,9 +52,12 @@ public class GoalSelector {
}
// Paper start
@@ -200,11 +200,11 @@ index b21e180641d17438997a80e5bcb0ec7998d24a2e..33c160994f70f71446d665e748791343
this.level().getProfiler().pop();
this.level().getProfiler().push("axolotlActivityUpdate");
diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
index 295769d039f2a1e4f48912a60f9dbe267d8992c1..e88b058c0734e436ef24bab6364b206c13e5a9c2 100644
index a03fb7aa9f4528f4885db88eaf480202d5f54750..1767fd2df8cb37e9c36fa3008b5131ff4bdad12c 100644
--- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
+++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java
@@ -159,9 +159,11 @@ public class Frog extends Animal implements VariantHolder<FrogVariant> {
@@ -183,9 +183,11 @@ public class Frog extends Animal implements VariantHolder<FrogVariant> {
}
}
+ private int behaviorTick = 0; // Pufferfish
@@ -248,11 +248,11 @@ index 5d247ac38fe8a61603b3d934f3000bcda773142b..2e4177cfb02616ef6fa689f6d378976e
this.level().getProfiler().pop();
this.level().getProfiler().push("goatActivityUpdate");
diff --git a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
index 01a2016ac82807d28ffe407b7dbb74bdbcde503e..9921b160fb21f72fbd28fe81ea66fbc3dc05f83f 100644
index 050ffa4a23feba29fdf4c6a175cdff4e5009027d..1299f93d4f983e6715e447add65df91ef9e9090a 100644
--- a/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
+++ b/src/main/java/net/minecraft/world/entity/monster/hoglin/Hoglin.java
@@ -128,9 +128,11 @@ public class Hoglin extends Animal implements Enemy, HoglinBase {
return (Brain<Hoglin>) super.getBrain(); // Paper - decompile fix
@@ -155,9 +155,11 @@ public class Hoglin extends Animal implements Enemy, HoglinBase {
return (Brain<Hoglin>)super.getBrain();
}
+ private int behaviorTick; // Pufferfish

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Pufferfish Reduce entity allocations
diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
index 897d7632ecfea40890433474870dd7a5e534d8ab..683c9693754d1a87b7e8fccc757a0d0963351f60 100644
index b99a080ab27e24d8131fda931ca70d6d271bb01c..8d6954d05d2bf6d6c1c4953db3127b011a858cec 100644
--- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
+++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMap.java
@@ -23,9 +23,11 @@ public class AttributeMap {
@@ -16,20 +16,18 @@ index 897d7632ecfea40890433474870dd7a5e534d8ab..683c9693754d1a87b7e8fccc757a0d09
public AttributeMap(AttributeSupplier defaultAttributes) {
this.supplier = defaultAttributes;
+ this.createInstance = attribute -> this.supplier.createInstance(this::onAttributeModified, attribute); // Pufferfish
+ this.createInstance = attributex -> this.supplier.createInstance(this::onAttributeModified, attributex); // Pufferfish
}
private void onAttributeModified(AttributeInstance instance) {
@@ -45,11 +47,10 @@ public class AttributeMap {
}).collect(Collectors.toList());
@@ -42,9 +44,10 @@ public class AttributeMap {
return this.attributes.values().stream().filter(attribute -> attribute.getAttribute().isClientSyncable()).collect(Collectors.toList());
}
+
@Nullable
public AttributeInstance getInstance(Attribute attribute) {
- return this.attributes.computeIfAbsent(attribute, (attributex) -> {
- return this.supplier.createInstance(this::onAttributeModified, attributex);
- });
- return this.attributes.computeIfAbsent(attribute, attributex -> this.supplier.createInstance(this::onAttributeModified, attributex));
+ return this.attributes.computeIfAbsent(attribute, this.createInstance); // Pufferfish - cache lambda, as for some reason java allocates it anyways
}

View File

@@ -459,12 +459,12 @@ index 82e7e76fecceb55522b5828a56f036e42ef55201..882e27de852c89c837d7943c5a9ae6fb
public static void entityInside(Level world, BlockPos pos, BlockState state, Entity entity, HopperBlockEntity blockEntity) {
diff --git a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
index f52ccd4f3e062af3c7cc6eaea5b074a3bbd21690..a5cd70b6ada2b44f64db0985483ee5eadc67003f 100644
index dfd1246b735fe64c5beae83567a013861eb00822..fa64bf5ad13c278438039b663ea3134e72108411 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/RandomizableContainerBlockEntity.java
@@ -94,12 +94,7 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc
public boolean isEmpty() {
this.unpackLootTable((Player)null);
this.unpackLootTable(null);
// Paper start - Perf: Optimize Hoppers
- for (final ItemStack itemStack : this.getItems()) {
- if (!itemStack.isEmpty()) {

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Gale Optimize sun burn tick
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 31f80438e82da6de1cd1ec35a2f77c45f0127722..6948342ef9fa4af0e13707e85cd788c815e34544 100644
index 62f997aae20fe392bc271b23b632441ce989c69c..485ca9a13a04ee47b27f1d23c6323583139865a1 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -308,7 +308,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -37,10 +37,10 @@ index 31f80438e82da6de1cd1ec35a2f77c45f0127722..6948342ef9fa4af0e13707e85cd788c8
this.absMoveTo(x, y, z);
this.setYRot(yaw % 360.0F);
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index a892ff1b3bc11df5f46269c5ae8838c4a7f91ea9..aa51819373465c733d0c31ae18ef97afee550767 100644
index abbbd6b56af8a177cd8ebfc5aa34c3f7282bdc59..b3ab33fb1e77cd1f95e4669fc7c7c2a188e813ca 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1749,13 +1749,29 @@ public abstract class Mob extends LivingEntity implements Targeting {
@@ -1750,13 +1750,29 @@ public abstract class Mob extends LivingEntity implements Targeting {
}

View File

@@ -133,10 +133,10 @@ index 49ccb27a17bec1d4ff31bc8d72e4724d65adc20c..34ccd489268c51c0aeecf5918878122b
public static long getBlockKey(final int x, final int y, final int z) {
diff --git a/src/main/java/net/minecraft/util/Mth.java b/src/main/java/net/minecraft/util/Mth.java
index 03854a2d26a3cfc1817acfdc28cbf151ba59e05b..d9e0224dc108a99c194d4947d18f2d855a341534 100644
index 28653d149bcbfa7bc37b8a09ae58229b908374f7..66192e92f18062f6bec377a43d6cfc5b277705a1 100644
--- a/src/main/java/net/minecraft/util/Mth.java
+++ b/src/main/java/net/minecraft/util/Mth.java
@@ -56,13 +56,11 @@ public class Mth {
@@ -57,13 +57,11 @@ public class Mth {
}
public static int floor(float value) {
@@ -152,7 +152,7 @@ index 03854a2d26a3cfc1817acfdc28cbf151ba59e05b..d9e0224dc108a99c194d4947d18f2d85
}
public static long lfloor(double value) {
@@ -79,13 +77,11 @@ public class Mth {
@@ -80,13 +78,11 @@ public class Mth {
}
public static int ceil(float value) {
@@ -168,15 +168,15 @@ index 03854a2d26a3cfc1817acfdc28cbf151ba59e05b..d9e0224dc108a99c194d4947d18f2d85
}
public static int clamp(int value, int min, int max) {
@@ -121,15 +117,7 @@ public class Mth {
@@ -122,15 +118,7 @@ public class Mth {
}
public static double absMax(double a, double b) {
- if (a < 0.0D) {
- if (a < 0.0) {
- a = -a;
- }
-
- if (b < 0.0D) {
- if (b < 0.0) {
- b = -b;
- }
-

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Gale Optimize noise generation
diff --git a/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java b/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java
index fb84d703b4461343d50510d7c9be32fc1f09ed22..93a11c95f96f975fafe03e77a2caace57675d130 100644
index 9a97e5cd23d839183ac4d243d28df92af3119fe7..0da2d816f0497eae0c055f3929b8194a3473a221 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/synth/ImprovedNoise.java
@@ -11,6 +11,27 @@ public final class ImprovedNoise {
@@ -34,9 +34,9 @@ index fb84d703b4461343d50510d7c9be32fc1f09ed22..93a11c95f96f975fafe03e77a2caace5
+ // Gale end - C2ME - optimize noise generation
+
public ImprovedNoise(RandomSource random) {
this.xo = random.nextDouble() * 256.0D;
this.yo = random.nextDouble() * 256.0D;
@@ -40,12 +61,14 @@ public final class ImprovedNoise {
this.xo = random.nextDouble() * 256.0;
this.yo = random.nextDouble() * 256.0;
@@ -38,12 +59,14 @@ public final class ImprovedNoise {
double d = x + this.xo;
double e = y + this.yo;
double f = z + this.zo;
@@ -55,16 +55,16 @@ index fb84d703b4461343d50510d7c9be32fc1f09ed22..93a11c95f96f975fafe03e77a2caace5
+ double l = f - k;
+ // Gale end - C2ME - optimize noise generation - optimize: remove frequent type conversions
double o;
if (yScale != 0.0D) {
if (yScale != 0.0) {
double m;
@@ -55,25 +78,27 @@ public final class ImprovedNoise {
@@ -53,25 +76,27 @@ public final class ImprovedNoise {
m = h;
}
- o = (double)Mth.floor(m / yScale + (double)1.0E-7F) * yScale;
- o = (double)Mth.floor(m / yScale + 1.0E-7F) * yScale;
+ o = Math.floor(m / yScale + (double)1.0E-7F) * yScale; // Gale - C2ME - optimize noise generation - optimize: remove frequent type conversions
} else {
o = 0.0D;
o = 0.0;
}
- return this.sampleAndLerp(i, j, k, g, h - o, l, h);
@@ -94,7 +94,7 @@ index fb84d703b4461343d50510d7c9be32fc1f09ed22..93a11c95f96f975fafe03e77a2caace5
}
private static double gradDot(int hash, double x, double y, double z) {
@@ -85,24 +110,69 @@ public final class ImprovedNoise {
@@ -83,24 +108,69 @@ public final class ImprovedNoise {
}
private double sampleAndLerp(int sectionX, int sectionY, int sectionZ, double localX, double localY, double localZ, double fadeLocalY) {
@@ -105,13 +105,13 @@ index fb84d703b4461343d50510d7c9be32fc1f09ed22..93a11c95f96f975fafe03e77a2caace5
- int m = this.p(j + sectionY);
- int n = this.p(j + sectionY + 1);
- double d = gradDot(this.p(k + sectionZ), localX, localY, localZ);
- double e = gradDot(this.p(m + sectionZ), localX - 1.0D, localY, localZ);
- double f = gradDot(this.p(l + sectionZ), localX, localY - 1.0D, localZ);
- double g = gradDot(this.p(n + sectionZ), localX - 1.0D, localY - 1.0D, localZ);
- double h = gradDot(this.p(k + sectionZ + 1), localX, localY, localZ - 1.0D);
- double o = gradDot(this.p(m + sectionZ + 1), localX - 1.0D, localY, localZ - 1.0D);
- double p = gradDot(this.p(l + sectionZ + 1), localX, localY - 1.0D, localZ - 1.0D);
- double q = gradDot(this.p(n + sectionZ + 1), localX - 1.0D, localY - 1.0D, localZ - 1.0D);
- double e = gradDot(this.p(m + sectionZ), localX - 1.0, localY, localZ);
- double f = gradDot(this.p(l + sectionZ), localX, localY - 1.0, localZ);
- double g = gradDot(this.p(n + sectionZ), localX - 1.0, localY - 1.0, localZ);
- double h = gradDot(this.p(k + sectionZ + 1), localX, localY, localZ - 1.0);
- double o = gradDot(this.p(m + sectionZ + 1), localX - 1.0, localY, localZ - 1.0);
- double p = gradDot(this.p(l + sectionZ + 1), localX, localY - 1.0, localZ - 1.0);
- double q = gradDot(this.p(n + sectionZ + 1), localX - 1.0, localY - 1.0, localZ - 1.0);
- double r = Mth.smoothstep(localX);
- double s = Mth.smoothstep(fadeLocalY);
- double t = Mth.smoothstep(localZ);
@@ -183,7 +183,7 @@ index fb84d703b4461343d50510d7c9be32fc1f09ed22..93a11c95f96f975fafe03e77a2caace5
private double sampleWithDerivative(int sectionX, int sectionY, int sectionZ, double localX, double localY, double localZ, double[] ds) {
diff --git a/src/main/java/net/minecraft/world/level/levelgen/synth/PerlinNoise.java b/src/main/java/net/minecraft/world/level/levelgen/synth/PerlinNoise.java
index 97ef7288ea935f3d17c5b7a9eba642143c786c2b..6d084145f8529fa8b0439123f9a9812940cc62da 100644
index 35820670837376bcad8891241724d5b946fbd31f..eb7aef08bd855416902d3e7988d07576ee13a9cb 100644
--- a/src/main/java/net/minecraft/world/level/levelgen/synth/PerlinNoise.java
+++ b/src/main/java/net/minecraft/world/level/levelgen/synth/PerlinNoise.java
@@ -26,6 +26,10 @@ public class PerlinNoise {
@@ -195,12 +195,12 @@ index 97ef7288ea935f3d17c5b7a9eba642143c786c2b..6d084145f8529fa8b0439123f9a98129
+ private final double [] amplitudesArray;
+ // Gale end - C2ME - optimize noise generation
/** @deprecated */
@Deprecated
@@ -131,6 +135,10 @@ public class PerlinNoise {
this.lowestFreqInputFactor = Math.pow(2.0D, (double)(-j));
this.lowestFreqValueFactor = Math.pow(2.0D, (double)(i - 1)) / (Math.pow(2.0D, (double)i) - 1.0D);
this.maxValue = this.edgeValue(2.0D);
public static PerlinNoise createLegacyForBlendedNoise(RandomSource random, IntStream octaves) {
@@ -127,6 +131,10 @@ public class PerlinNoise {
this.lowestFreqInputFactor = Math.pow(2.0, (double)(-j));
this.lowestFreqValueFactor = Math.pow(2.0, (double)(i - 1)) / (Math.pow(2.0, (double)i) - 1.0);
this.maxValue = this.edgeValue(2.0);
+ // Gale start - C2ME - optimize noise generation
+ this.octaveSamplersCount = this.noiseLevels.length;
+ this.amplitudesArray = this.amplitudes.toDoubleArray();
@@ -208,11 +208,11 @@ index 97ef7288ea935f3d17c5b7a9eba642143c786c2b..6d084145f8529fa8b0439123f9a98129
}
protected double maxValue() {
@@ -142,7 +150,27 @@ public class PerlinNoise {
@@ -138,7 +146,27 @@ public class PerlinNoise {
}
public double getValue(double x, double y, double z) {
- return this.getValue(x, y, z, 0.0D, 0.0D, false);
- return this.getValue(x, y, z, 0.0, 0.0, false);
+ // Gale start - C2ME - optimize noise generation - optimize for common cases
+ double d = 0.0;
+ double e = this.lowestFreqInputFactor;
@@ -236,4 +236,4 @@ index 97ef7288ea935f3d17c5b7a9eba642143c786c2b..6d084145f8529fa8b0439123f9a98129
+ // Gale end - C2ME - optimize noise generation - optimize for common cases
}
/** @deprecated */
@Deprecated

View File

@@ -214,10 +214,10 @@ index 8bafd5fd7499ba4a04bf706cfd1e156073716e21..f62aab492f231e688b448389b1910e6f
+ <T> void compact(net.minecraft.world.level.chunk.Palette<T> srcPalette, net.minecraft.world.level.chunk.Palette<T> dstPalette, short[] out); // Gale - Lithium - faster chunk serialization
}
diff --git a/src/main/java/net/minecraft/util/SimpleBitStorage.java b/src/main/java/net/minecraft/util/SimpleBitStorage.java
index 453c1d7e01970fd817d27f59c3b00ffc70e8ca0c..844539798213360831541f49d97f8401d80d030e 100644
index 8d7d763bf51cac556057645e6169c9447993189b..c1e5f04df9529e9236a5c8a047b02ad560085025 100644
--- a/src/main/java/net/minecraft/util/SimpleBitStorage.java
+++ b/src/main/java/net/minecraft/util/SimpleBitStorage.java
@@ -201,4 +201,45 @@ public class SimpleBitStorage implements BitStorage {
@@ -389,4 +389,45 @@ public class SimpleBitStorage implements BitStorage {
super(message);
}
}
@@ -264,10 +264,10 @@ index 453c1d7e01970fd817d27f59c3b00ffc70e8ca0c..844539798213360831541f49d97f8401
+
}
diff --git a/src/main/java/net/minecraft/util/ZeroBitStorage.java b/src/main/java/net/minecraft/util/ZeroBitStorage.java
index f8de91393564b3691c17339ac9196cc0fc1cf748..ecfe47110697378d7f7369640cd06b77f6fa0a87 100644
index 01f5b946fabbe34f31110e75973dab9f39897346..1cd79ab7635d4a5e55538c1130f487245f45b4b6 100644
--- a/src/main/java/net/minecraft/util/ZeroBitStorage.java
+++ b/src/main/java/net/minecraft/util/ZeroBitStorage.java
@@ -72,4 +72,6 @@ public class ZeroBitStorage implements BitStorage {
@@ -71,4 +71,6 @@ public class ZeroBitStorage implements BitStorage {
public BitStorage copy() {
return this;
}
@@ -286,7 +286,7 @@ index acae3eb30e0689048937f479dc3070f0688abdad..4b79f0474a9013dd4fdb68c6363ca194
int onResize(int newBits, T object);
}
diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
index 983799520ce052d98c9231f4f7925492d4f7d5c9..6e7b3ea1819780aef6db3ff0b43998de8f1066bf 100644
index adfbdca12fbdee2602feb0158674166d5256e49e..9990e60f61d678e20cfffe22848eb5cc7c554b8a 100644
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
@@ -25,6 +25,22 @@ import net.minecraft.util.ThreadingDetector;
@@ -310,9 +310,9 @@ index 983799520ce052d98c9231f4f7925492d4f7d5c9..6e7b3ea1819780aef6db3ff0b43998de
+ // Gale end - Lithium - faster chunk serialization
+
private static final int MIN_PALETTE_BITS = 0;
private final PaletteResize<T> dummyPaletteResize = (newSize, added) -> {
return 0;
@@ -302,30 +318,54 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
private final PaletteResize<T> dummyPaletteResize = (newSize, added) -> 0;
public final IdMap<T> registry;
@@ -304,28 +320,54 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
public synchronized PalettedContainerRO.PackedData<T> pack(IdMap<T> idList, PalettedContainer.Strategy paletteProvider) { // Paper - synchronize
this.acquire();
@@ -325,9 +325,7 @@ index 983799520ce052d98c9231f4f7925492d4f7d5c9..6e7b3ea1819780aef6db3ff0b43998de
- int i = paletteProvider.size();
- int[] is = new int[i];
- this.data.storage.unpack(is);
- swapPalette(is, (id) -> {
- return hashMapPalette.idFor(this.data.palette.valueFor(id));
- });
- swapPalette(is, id -> hashMapPalette.idFor(this.data.palette.valueFor(id)));
- int j = paletteProvider.calculateBitsForSerialization(idList, hashMapPalette.getSize());
- Optional<LongStream> optional;
- if (j != 0) {
@@ -384,7 +382,7 @@ index 983799520ce052d98c9231f4f7925492d4f7d5c9..6e7b3ea1819780aef6db3ff0b43998de
}
private static <T> void swapPalette(int[] is, IntUnaryOperator applier) {
@@ -365,17 +405,37 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
@@ -364,13 +406,33 @@ public class PalettedContainer<T> implements PaletteResize<T>, PalettedContainer
@Override
public void count(PalettedContainer.CountConsumer<T> counter) {
@@ -392,12 +390,8 @@ index 983799520ce052d98c9231f4f7925492d4f7d5c9..6e7b3ea1819780aef6db3ff0b43998de
- counter.accept(this.data.palette.valueFor(0), this.data.storage.getSize());
- } else {
- Int2IntOpenHashMap int2IntOpenHashMap = new Int2IntOpenHashMap();
- this.data.storage.getAll((key) -> {
- int2IntOpenHashMap.addTo(key, 1);
- });
- int2IntOpenHashMap.int2IntEntrySet().forEach((entry) -> {
- counter.accept(this.data.palette.valueFor(entry.getIntKey()), entry.getIntValue());
- });
- this.data.storage.getAll(key -> int2IntOpenHashMap.addTo(key, 1));
- int2IntOpenHashMap.int2IntEntrySet().forEach(entry -> counter.accept(this.data.palette.valueFor(entry.getIntKey()), entry.getIntValue()));
+ // Gale start - Lithium - faster chunk serialization
+ int len = this.data.palette().getSize();
+
@@ -408,12 +402,8 @@ index 983799520ce052d98c9231f4f7925492d4f7d5c9..6e7b3ea1819780aef6db3ff0b43998de
+ counter.accept(this.data.palette.valueFor(0), this.data.storage.getSize());
+ } else {
+ Int2IntOpenHashMap int2IntOpenHashMap = new Int2IntOpenHashMap();
+ this.data.storage.getAll((key) -> {
+ int2IntOpenHashMap.addTo(key, 1);
+ });
+ int2IntOpenHashMap.int2IntEntrySet().forEach((entry) -> {
+ counter.accept(this.data.palette.valueFor(entry.getIntKey()), entry.getIntValue());
+ });
+ this.data.storage.getAll(key -> int2IntOpenHashMap.addTo(key, 1));
+ int2IntOpenHashMap.int2IntEntrySet().forEach(entry -> counter.accept(this.data.palette.valueFor(entry.getIntKey()), entry.getIntValue()));
+ }
+ }
+

View File

@@ -6,16 +6,15 @@ Subject: [PATCH] Gale Reduce lambda and Optional allocation in
diff --git a/src/main/java/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java b/src/main/java/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java
index 2f9f15d99f8b31e9f13f7f32378b2a9e09bcb5e5..4e4dfb72d5a0b46917999b709c655ccfdae27183 100644
index 3527f1621ef9b4f3f8d8bbb93379f13ff141c3be..4e4dfb72d5a0b46917999b709c655ccfdae27183 100644
--- a/src/main/java/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java
+++ b/src/main/java/net/minecraft/world/level/EntityBasedExplosionDamageCalculator.java
@@ -15,9 +15,17 @@ public class EntityBasedExplosionDamageCalculator extends ExplosionDamageCalcula
@@ -15,8 +15,17 @@ public class EntityBasedExplosionDamageCalculator extends ExplosionDamageCalcula
@Override
public Optional<Float> getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState) {
- return super.getBlockExplosionResistance(explosion, world, pos, blockState, fluidState).map((max) -> {
- return this.source.getBlockExplosionResistance(explosion, world, pos, blockState, fluidState, max);
- });
- return super.getBlockExplosionResistance(explosion, world, pos, blockState, fluidState)
- .map(max -> this.source.getBlockExplosionResistance(explosion, world, pos, blockState, fluidState, max));
+ // Gale start - Lithium - reduce lambda and Optional allocation in EntityBasedExplosionDamageCalculator
+ Optional<Float> optionalBlastResistance = super.getBlockExplosionResistance(explosion, world, pos, blockState, fluidState);
+ if (optionalBlastResistance.isPresent()) {

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Gale Replace AI goal set with optimized collection
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
index 0f53c206b4c0607e2cda5cfa4edeae5209e897bf..6313020a80cab0b8df8d775431d4aa063c51ce18 100644
index f97b41422949bc6521b289daa6ca2861f25885a0..bcda232bb1c2490f14dd26aaca52afbc597ea9b7 100644
--- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
@@ -13,6 +13,7 @@ import java.util.function.Supplier;
@@ -14,6 +14,7 @@ import java.util.function.Supplier;
import java.util.stream.Stream;
import net.minecraft.util.profiling.ProfilerFiller;
import org.slf4j.Logger;
@@ -16,7 +16,7 @@ index 0f53c206b4c0607e2cda5cfa4edeae5209e897bf..6313020a80cab0b8df8d775431d4aa06
public class GoalSelector {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -28,7 +29,7 @@ public class GoalSelector {
@@ -29,7 +30,7 @@ public class GoalSelector {
}
};
private final Map<Goal.Flag, WrappedGoal> lockedFlags = new EnumMap<>(Goal.Flag.class);

View File

@@ -18,7 +18,7 @@ index 6ab9f83786dcfbd3156d2f2bd6da57baed1399f4..09b72783bab881a42d94b77c453c638f
}
// CraftBukkit end
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 74e7fefe0819829f9280cf1602cca841f796e7a3..b76056ce93a1133eb7b50a7855830afea478bf17 100644
index b57980d4fa445f2aa71e4477459da833eade50e8..a68485e29466f26d1cb94cd827f5a5d9645b1e5c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -187,7 +187,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -30,7 +30,7 @@ index 74e7fefe0819829f9280cf1602cca841f796e7a3..b76056ce93a1133eb7b50a7855830afe
private final Set<UUID> unlistedEntities = new HashSet<>(); // Paper - Add Listing API for Player
private static final WeakHashMap<Plugin, WeakReference<Plugin>> pluginWeakReferences = new WeakHashMap<>();
private int hash = 0;
@@ -2146,9 +2146,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2148,9 +2148,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public boolean canSee(org.bukkit.entity.Entity entity) {

View File

@@ -149,7 +149,7 @@ index 676a1499747b071515479130875157263d3a8352..e5ef298dc1df9cc42b3d349939a966b7
if (((List) object).size() >= i) {
return (List) object;
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 18b8651147dedcf80d9baf04e87fb25cfbf9b89f..e9a49eb00c64d864ebf4b24d6fe84aba7b2dbed8 100644
index 936f8663b23908ac5de2076401a5d508f88a0376..0e8e57c291539e50f61e8178fc355fa698248967 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -179,6 +179,14 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -168,7 +168,7 @@ index 18b8651147dedcf80d9baf04e87fb25cfbf9b89f..e9a49eb00c64d864ebf4b24d6fe84aba
super.channelActive(channelhandlercontext);
this.channel = channelhandlercontext.channel();
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index d2e02ccdfbea138f8afe335a8b8c50f0696d7108..f03f01e6a3a0d0c1e99dde1d102178d57f9c342b 100644
index 08b0d3b970a7c86f577d20487d5fe3930b8eae6e..8ea86315e09a6b182bab03ee902ef92c5e18d962 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1727,7 +1727,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -197,18 +197,18 @@ index 24e5993b281448734eb67c7a8439a349bbf9fd72..da840e40dbb0f0c8dab5fbb27e2cfe6a
AdvancementProgress advancementprogress = this.getOrStartProgress(advancement);
boolean flag1 = advancementprogress.isDone();
diff --git a/src/main/java/net/minecraft/server/commands/OpCommand.java b/src/main/java/net/minecraft/server/commands/OpCommand.java
index 2e2a7c2cf3081187da817479a9da3eb10f662a6d..ee616fe98c98a345872c1eadf41c78524d131b61 100644
index e7b444a10b244828827b3c66c53465206ea8e0ec..030601fdfde2232a933b2ad7022e9909db3a3783 100644
--- a/src/main/java/net/minecraft/server/commands/OpCommand.java
+++ b/src/main/java/net/minecraft/server/commands/OpCommand.java
@@ -20,7 +20,7 @@ public class OpCommand {
return source.hasPermission(3);
}).then(Commands.argument("targets", GameProfileArgument.gameProfile()).suggests((context, builder) -> {
PlayerList playerList = context.getSource().getServer().getPlayerList();
- return SharedSuggestionProvider.suggest(playerList.getPlayers().stream().filter((player) -> {
+ return SharedSuggestionProvider.suggest(playerList.realPlayers.stream().filter((player) -> { // Leaves - only real player
return !playerList.isOp(player.getGameProfile());
}).map((player) -> {
return player.getGameProfile().getName();
@@ -25,7 +25,7 @@ public class OpCommand {
(context, builder) -> {
PlayerList playerList = context.getSource().getServer().getPlayerList();
return SharedSuggestionProvider.suggest(
- playerList.getPlayers()
+ playerList.realPlayers // Leaves - only real player
.stream()
.filter(player -> !playerList.isOp(player.getGameProfile()))
.map(player -> player.getGameProfile().getName()),
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 0086a1a4611b983eefd0cb7bf8e9cff677246d0f..dcbf18eb7fb9a37fcd7faf3efe023d2503b4091a 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -223,7 +223,7 @@ index 0086a1a4611b983eefd0cb7bf8e9cff677246d0f..dcbf18eb7fb9a37fcd7faf3efe023d25
private final ServerStatsCounter stats;
private float lastRecordedHealthAndAbsorption = Float.MIN_VALUE;
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 4fc9a47745b817d9ee2da4776cab26ff9f3b0025..e0a103ed27f834f62afb3696047c7581aa608f49 100644
index e0f12426f18b343b27089440cd01127d79600ef0..fbe2372d871f8f2b53b04f7bddf3a5652f2eb394 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -297,7 +297,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -242,7 +242,7 @@ index 4fc9a47745b817d9ee2da4776cab26ff9f3b0025..e0a103ed27f834f62afb3696047c7581
player.connection = this;
player.getTextFilter().join();
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 90be312057221a5a78066d89783c5e22008d797d..185a4788809c0aec69420933944b468cbdbceda5 100644
index 90be312057221a5a78066d89783c5e22008d797d..24f52fde099bac6f7c6a61cfc28a2b23437a116d 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -13,15 +13,7 @@ import java.net.SocketAddress;
@@ -544,10 +544,10 @@ index 8c7e01972888df4ccbaccc4eebceeeb5ab357f4c..99956f506d543c2917746d5eb0955981
if (entity instanceof EnderDragonPart complexPart) {
if (complexPart.parentMob instanceof EnderDragon) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index b76056ce93a1133eb7b50a7855830afea478bf17..a7f953a75ca8b460e3b4790f690e133bef777d89 100644
index a68485e29466f26d1cb94cd827f5a5d9645b1e5c..2a5e76b1cee25b05189bb75daad4ced939bbb343 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2141,7 +2141,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2143,7 +2143,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public boolean canSee(Player player) {

View File

@@ -101,7 +101,7 @@ index 0000000000000000000000000000000000000000..53b4397997bc9b9b9d88e48304b37a25
+ }
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index f03f01e6a3a0d0c1e99dde1d102178d57f9c342b..1be341252cd0db3b5166eb04f7334b3bb3c814af 100644
index 8ea86315e09a6b182bab03ee902ef92c5e18d962..d933895e833bea1720cc32256e98e0fe3638f4eb 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1654,6 +1654,17 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -241,7 +241,7 @@ index 094ab43e5a209ea848bf0994db9018281c64e08d..e2084013770e78d006ddd9547f6c9040
+ // KioCG end
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 0893b62e72fe03a14e7617f28676f53f77e7624c..8a0cf571195fa8f8771a03cba329dac294bdbece 100644
index 82ffe6571b06a482296fb28e37aa148daf6a0ce6..9293fb2dec97e6c6bf5abe5eb7d1878bb7f200d1 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -5898,4 +5898,6 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -268,10 +268,10 @@ index 0a8a53710c693a220e9475f6f3112b91d8209c00..5053852c72b68db41a2f51a72fffa1f8
+ // KioCG end
}
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index aa51819373465c733d0c31ae18ef97afee550767..94cf8625c3c15757039cf8ac295f4def703f2b26 100644
index b3ab33fb1e77cd1f95e4669fc7c7c2a188e813ca..4c26749515f7d4508f749caf4ae90607131bed4e 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1830,4 +1830,11 @@ public abstract class Mob extends LivingEntity implements Targeting {
@@ -1831,4 +1831,11 @@ public abstract class Mob extends LivingEntity implements Targeting {
return itemmonsteregg == null ? null : new ItemStack(itemmonsteregg);
}
@@ -433,10 +433,10 @@ index dca5f25cf331b5550e9be491b4e8a3466531e021..0dee50f136b81f788f84beeb1ad87200
+ // KioCG end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index a7f953a75ca8b460e3b4790f690e133bef777d89..a3f6e02bc4b2a62708efc94b44caf27cb9bf5c62 100644
index 2a5e76b1cee25b05189bb75daad4ced939bbb343..51caaac770b063a4be432b06030e325047651e91 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -3450,4 +3450,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -3481,4 +3481,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void setSendViewDistance(final int viewDistance) {
this.getHandle().setSendViewDistance(viewDistance);
}

View File

@@ -9,7 +9,7 @@ pluginManagement {
rootProject.name = "luminol"
for (name in listOf("Luminol-API", "Luminol-Server")) {
val projName = name.toLowerCase(Locale.ENGLISH)
val projName = name.lowercase(Locale.ENGLISH)
include(projName)
findProject(":$projName")!!.projectDir = file(name)
}