aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLulu13022002 <[email protected]>2024-12-16 18:07:41 +0100
committerLulu13022002 <[email protected]>2024-12-16 18:07:41 +0100
commit9e8a2de45b690a45351117615782975496f52947 (patch)
tree0788780c14dc8a633835e7598e8fe86b6f512145
parent48be22a63ec1e323a99605478aa72150280e7a28 (diff)
downloadPaper-9e8a2de45b690a45351117615782975496f52947.tar.gz
Paper-9e8a2de45b690a45351117615782975496f52947.zip
readd bukkit extra data to entity tags
-rw-r--r--paper-server/patches/features/0002-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch4
-rw-r--r--paper-server/patches/features/0009-Optimize-GoalSelector-Goal.Flag-Set-operations.patch32
-rw-r--r--paper-server/patches/sources/net/minecraft/server/level/ServerPlayer.java.patch12
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/ai/behavior/PrepareRamNearestTarget.java.patch10
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java.patch4
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/ai/goal/Goal.java.patch4
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/ai/goal/target/TargetGoal.java.patch2
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/ai/sensing/Sensor.java.patch12
8 files changed, 38 insertions, 42 deletions
diff --git a/paper-server/patches/features/0002-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch b/paper-server/patches/features/0002-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch
index a98c97715f..a7533a2d46 100644
--- a/paper-server/patches/features/0002-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch
+++ b/paper-server/patches/features/0002-Improve-Maps-in-item-frames-performance-and-bug-fixe.patch
@@ -28,10 +28,10 @@ index 678b3027e8c53e6021ea49afa69cdbe5f60dcf25..cce78d73e8adafd66d0f3ffb3fabb5e6
}
}
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
-index e3a4cf9cd03670705391f4dc68f193d7cee656e0..f9c9485a051f5fa6d508b8a194c9f17657e1a0f4 100644
+index cfd30aa774d3bb3049ff9331a623624c6a13f774..940509d1f31aedf20b8f5b9192c34ad004875728 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
-@@ -2654,6 +2654,14 @@ public class ServerPlayer extends Player {
+@@ -2655,6 +2655,14 @@ public class ServerPlayer extends Player {
this.awardStat(Stats.DROP);
}
diff --git a/paper-server/patches/features/0009-Optimize-GoalSelector-Goal.Flag-Set-operations.patch b/paper-server/patches/features/0009-Optimize-GoalSelector-Goal.Flag-Set-operations.patch
index 2c4bd4a04c..8d68059b74 100644
--- a/paper-server/patches/features/0009-Optimize-GoalSelector-Goal.Flag-Set-operations.patch
+++ b/paper-server/patches/features/0009-Optimize-GoalSelector-Goal.Flag-Set-operations.patch
@@ -7,7 +7,7 @@ Optimise the stream.anyMatch statement to move to a bitset
where we can replace the call with a single bitwise operation.
diff --git a/net/minecraft/world/entity/ai/goal/Goal.java b/net/minecraft/world/entity/ai/goal/Goal.java
-index e99836c4073d8b25eddd3b4c784dbdb1f0c4f2b1..a2d788a656b2a5767c8a00bbcaca16efa2db8d24 100644
+index d4f8387254a65b25fc808932a069298d0f8da091..5f5bf0e710ecff09a571091e5a923332be70cb74 100644
--- a/net/minecraft/world/entity/ai/goal/Goal.java
+++ b/net/minecraft/world/entity/ai/goal/Goal.java
@@ -7,7 +7,15 @@ import net.minecraft.world.entity.Entity;
@@ -15,15 +15,15 @@ index e99836c4073d8b25eddd3b4c784dbdb1f0c4f2b1..a2d788a656b2a5767c8a00bbcaca16ef
public abstract class Goal {
- private final EnumSet<Goal.Flag> flags = EnumSet.noneOf(Goal.Flag.class);
-+ private final ca.spottedleaf.moonrise.common.set.OptimizedSmallEnumSet<net.minecraft.world.entity.ai.goal.Goal.Flag> goalTypes = new ca.spottedleaf.moonrise.common.set.OptimizedSmallEnumSet<>(Goal.Flag.class); // Paper - remove streams from pathfindergoalselector
++ private final ca.spottedleaf.moonrise.common.set.OptimizedSmallEnumSet<net.minecraft.world.entity.ai.goal.Goal.Flag> goalTypes = new ca.spottedleaf.moonrise.common.set.OptimizedSmallEnumSet<>(Goal.Flag.class); // Paper - remove streams from GoalSelector
+
-+ // Paper start - remove streams from pathfindergoalselector; make sure types are not empty
++ // Paper start - remove streams from GoalSelector; make sure types are not empty
+ protected Goal() {
+ if (this.goalTypes.size() == 0) {
+ this.goalTypes.addUnchecked(Flag.UNKNOWN_BEHAVIOR);
+ }
+ }
-+ // Paper end - remove streams from pathfindergoalselector
++ // Paper end - remove streams from GoalSelector
public abstract boolean canUse();
@@ -33,13 +33,13 @@ index e99836c4073d8b25eddd3b4c784dbdb1f0c4f2b1..a2d788a656b2a5767c8a00bbcaca16ef
public void setFlags(EnumSet<Goal.Flag> flagSet) {
- this.flags.clear();
- this.flags.addAll(flagSet);
-+ // Paper start - remove streams from pathfindergoalselector
++ // Paper start - remove streams from GoalSelector
+ this.goalTypes.clear();
+ this.goalTypes.addAllUnchecked(flagSet);
+ if (this.goalTypes.size() == 0) {
+ this.goalTypes.addUnchecked(Flag.UNKNOWN_BEHAVIOR);
+ }
-+ // Paper end - remove streams from pathfindergoalselector;
++ // Paper end - remove streams from GoalSelector
}
@Override
@@ -49,10 +49,10 @@ index e99836c4073d8b25eddd3b4c784dbdb1f0c4f2b1..a2d788a656b2a5767c8a00bbcaca16ef
- public EnumSet<Goal.Flag> getFlags() {
- return this.flags;
-+ // Paper start - remove streams from pathfindergoalselector
++ // Paper start - remove streams from GoalSelector
+ public ca.spottedleaf.moonrise.common.set.OptimizedSmallEnumSet<Goal.Flag> getFlags() {
+ return this.goalTypes;
-+ // Paper end - remove streams from pathfindergoalselector
++ // Paper end - remove streams from GoalSelector
}
@@ -66,10 +66,10 @@ index e99836c4073d8b25eddd3b4c784dbdb1f0c4f2b1..a2d788a656b2a5767c8a00bbcaca16ef
- this.flags.add(flag);
+ this.goalTypes.addUnchecked(flag);
}
-
// Paper end - Mob Goal API
+
diff --git a/net/minecraft/world/entity/ai/goal/GoalSelector.java b/net/minecraft/world/entity/ai/goal/GoalSelector.java
-index eeba224bd575451ba6023df65ef9d9b97f7f1c71..20f0c1a444f40b28fe4de9ebc9eb40243c1f22a0 100644
+index eeba224bd575451ba6023df65ef9d9b97f7f1c71..a927c2790c8ab9ccaa7161b970e10b0b44817dd8 100644
--- a/net/minecraft/world/entity/ai/goal/GoalSelector.java
+++ b/net/minecraft/world/entity/ai/goal/GoalSelector.java
@@ -24,7 +24,8 @@ public class GoalSelector {
@@ -77,8 +77,8 @@ index eeba224bd575451ba6023df65ef9d9b97f7f1c71..20f0c1a444f40b28fe4de9ebc9eb4024
private final Map<Goal.Flag, WrappedGoal> lockedFlags = new EnumMap<>(Goal.Flag.class);
private final Set<WrappedGoal> availableGoals = new ObjectLinkedOpenHashSet<>();
- private final EnumSet<Goal.Flag> disabledFlags = EnumSet.noneOf(Goal.Flag.class);
-+ private static final Goal.Flag[] GOAL_FLAG_VALUES = Goal.Flag.values(); // Paper - remove streams from pathfindergoalselector
-+ private final ca.spottedleaf.moonrise.common.set.OptimizedSmallEnumSet<net.minecraft.world.entity.ai.goal.Goal.Flag> goalTypes = new ca.spottedleaf.moonrise.common.set.OptimizedSmallEnumSet<>(Goal.Flag.class); // Paper - remove streams from pathfindergoalselector
++ private static final Goal.Flag[] GOAL_FLAG_VALUES = Goal.Flag.values(); // Paper - remove streams from GoalSelector
++ private final ca.spottedleaf.moonrise.common.set.OptimizedSmallEnumSet<net.minecraft.world.entity.ai.goal.Goal.Flag> goalTypes = new ca.spottedleaf.moonrise.common.set.OptimizedSmallEnumSet<>(Goal.Flag.class); // Paper - remove streams from GoalSelector
private int curRate; // Paper - EAR 2
public void addGoal(int priority, Goal goal) {
@@ -144,17 +144,17 @@ index eeba224bd575451ba6023df65ef9d9b97f7f1c71..20f0c1a444f40b28fe4de9ebc9eb4024
public void disableControlFlag(Goal.Flag flag) {
- this.disabledFlags.add(flag);
-+ this.goalTypes.addUnchecked(flag); // Paper - remove streams from pathfindergoalselector
++ this.goalTypes.addUnchecked(flag); // Paper - remove streams from GoalSelector
}
public void enableControlFlag(Goal.Flag flag) {
- this.disabledFlags.remove(flag);
-+ this.goalTypes.removeUnchecked(flag); // Paper - remove streams from pathfindergoalselector
++ this.goalTypes.removeUnchecked(flag); // Paper - remove streams from GoalSelector
}
public void setControlFlag(Goal.Flag flag, boolean enabled) {
diff --git a/net/minecraft/world/entity/ai/goal/WrappedGoal.java b/net/minecraft/world/entity/ai/goal/WrappedGoal.java
-index 4bdbd323b642ed3422948fe24780be8b503602dc..5aaad796d2e2f7b57b1fd911a1498cdf235c36be 100644
+index 4bdbd323b642ed3422948fe24780be8b503602dc..2c2ab6a1df9d3d23773e44ce4041cc1c21b55163 100644
--- a/net/minecraft/world/entity/ai/goal/WrappedGoal.java
+++ b/net/minecraft/world/entity/ai/goal/WrappedGoal.java
@@ -69,7 +69,7 @@ public class WrappedGoal extends Goal {
@@ -162,7 +162,7 @@ index 4bdbd323b642ed3422948fe24780be8b503602dc..5aaad796d2e2f7b57b1fd911a1498cdf
@Override
- public EnumSet<Goal.Flag> getFlags() {
-+ public ca.spottedleaf.moonrise.common.set.OptimizedSmallEnumSet<Goal.Flag> getFlags() { // Paper - remove streams from pathfindergoalselector
++ public ca.spottedleaf.moonrise.common.set.OptimizedSmallEnumSet<Goal.Flag> getFlags() { // Paper - remove streams from GoalSelector
return this.goal.getFlags();
}
diff --git a/paper-server/patches/sources/net/minecraft/server/level/ServerPlayer.java.patch b/paper-server/patches/sources/net/minecraft/server/level/ServerPlayer.java.patch
index 64c374439b..0a308ad258 100644
--- a/paper-server/patches/sources/net/minecraft/server/level/ServerPlayer.java.patch
+++ b/paper-server/patches/sources/net/minecraft/server/level/ServerPlayer.java.patch
@@ -5,7 +5,7 @@
private boolean disconnected;
private int requestedViewDistance = 2;
- public String language = "en_us";
-+ public String language = null; // CraftBukkit - default // Paper - default to null
++ public String language = null; // Paper - default to null
+ public java.util.Locale adventure$locale = java.util.Locale.US; // Paper
@Nullable
private Vec3 startingToFallPosition;
@@ -106,7 +106,7 @@
this.advancements = server.getPlayerList().getPlayerAdvancements(this);
- this.moveTo(this.adjustSpawnLocation(level, level.getSharedSpawnPos()).getBottomCenter(), 0.0F, 0.0F);
- this.updateOptions(clientInformation);
-+ // this.moveTo(this.adjustSpawnLocation(level, level.getSharedSpawnPos()).getBottomCenter(), 0.0F, 0.0F); // Paper - Don't move existing players to world spawn
++ // this.moveTo(this.adjustSpawnLocation(level, level.getSharedSpawnPos()).getBottomCenter(), 0.0F, 0.0F); // Paper - Don't move existing players to world spawn
+ this.updateOptionsNoEvents(clientInformation); // Paper - don't call options events on login
this.object = null;
+
@@ -196,6 +196,14 @@
if (compound.contains("SpawnX", 99) && compound.contains("SpawnY", 99) && compound.contains("SpawnZ", 99)) {
this.respawnPosition = new BlockPos(compound.getInt("SpawnX"), compound.getInt("SpawnY"), compound.getInt("SpawnZ"));
this.respawnForced = compound.getBoolean("SpawnForced");
+@@ -475,6 +_,7 @@
+ .resultOrPartial(LOGGER::error)
+ .ifPresent(spawnDimension -> compound.put("SpawnDimension", spawnDimension));
+ }
++ this.getBukkitEntity().setExtraData(compound); // CraftBukkit
+
+ compound.putBoolean("spawn_extra_particles_on_fall", this.spawnExtraParticlesOnFall);
+ if (this.raidOmenPosition != null) {
@@ -490,7 +_,18 @@
private void saveParentVehicle(CompoundTag tag) {
Entity rootVehicle = this.getRootVehicle();
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/ai/behavior/PrepareRamNearestTarget.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/ai/behavior/PrepareRamNearestTarget.java.patch
index 239d6f934e..6df8611d59 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/ai/behavior/PrepareRamNearestTarget.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/ai/behavior/PrepareRamNearestTarget.java.patch
@@ -1,20 +1,12 @@
--- a/net/minecraft/world/entity/ai/behavior/PrepareRamNearestTarget.java
+++ b/net/minecraft/world/entity/ai/behavior/PrepareRamNearestTarget.java
-@@ -10,6 +_,7 @@
- import net.minecraft.core.BlockPos;
- import net.minecraft.core.Direction;
- import net.minecraft.server.level.ServerLevel;
-+import net.minecraft.server.level.ServerPlayer;
- import net.minecraft.sounds.SoundEvent;
- import net.minecraft.sounds.SoundSource;
- import net.minecraft.util.Mth;
@@ -75,6 +_,16 @@
.flatMap(
nearestVisibleLivingEntities -> nearestVisibleLivingEntities.findClosest(livingEntity -> this.ramTargeting.test(level, entity, livingEntity))
)
+ // CraftBukkit start
+ .map((entityliving) -> {
-+ org.bukkit.event.entity.EntityTargetEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetLivingEvent(entity, entityliving, (entityliving instanceof ServerPlayer) ? org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER : org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_ENTITY);
++ org.bukkit.event.entity.EntityTargetEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetLivingEvent(entity, entityliving, (entityliving instanceof net.minecraft.server.level.ServerPlayer) ? org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER : org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_ENTITY);
+ if (event.isCancelled() || event.getTarget() == null) {
+ return null;
+ }
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java.patch
index 3556764a3b..9f783335fb 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/ai/behavior/WorkAtComposter.java.patch
@@ -4,9 +4,9 @@
inventory.removeItemType(Items.WHEAT, i3);
ItemStack itemStack = inventory.addItem(new ItemStack(Items.BREAD, min));
if (!itemStack.isEmpty()) {
-+ villager.forceDrops = true; // Paper - Add missing forceDrop toggle
++ villager.forceDrops = true; // Paper - Add missing forceDrop toggles
villager.spawnAtLocation(level, itemStack, 0.5F);
-+ villager.forceDrops = false; // Paper - Add missing forceDrop toggle
++ villager.forceDrops = false; // Paper - Add missing forceDrop toggles
}
}
}
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/ai/goal/Goal.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/ai/goal/Goal.java.patch
index 34a28aaf49..8760a911ad 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/ai/goal/Goal.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/ai/goal/Goal.java.patch
@@ -13,8 +13,8 @@
+ public void addFlag(final Goal.Flag flag) {
+ this.flags.add(flag);
+ }
-+
+ // Paper end - Mob Goal API
++
protected int adjustedTickDelay(int adjustment) {
return this.requiresUpdateEveryTick() ? adjustment : reducedTickDelay(adjustment);
}
@@ -25,7 +25,7 @@
+ // Paper start - Mob goal api
+ private com.destroystokyo.paper.entity.ai.PaperVanillaGoal<?> vanillaGoal;
+ public <T extends org.bukkit.entity.Mob> com.destroystokyo.paper.entity.ai.Goal<T> asPaperVanillaGoal() {
-+ if(this.vanillaGoal == null) {
++ if (this.vanillaGoal == null) {
+ this.vanillaGoal = new com.destroystokyo.paper.entity.ai.PaperVanillaGoal<>(this);
+ }
+ //noinspection unchecked
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/ai/goal/target/TargetGoal.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/ai/goal/target/TargetGoal.java.patch
index 9973960f95..68b320d4df 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/ai/goal/target/TargetGoal.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/ai/goal/target/TargetGoal.java.patch
@@ -14,7 +14,7 @@
@Override
public void stop() {
- this.mob.setTarget(null);
-+ this.mob.setTarget((LivingEntity) null, org.bukkit.event.entity.EntityTargetEvent.TargetReason.FORGOT_TARGET, true); // CraftBukkit
++ this.mob.setTarget(null, org.bukkit.event.entity.EntityTargetEvent.TargetReason.FORGOT_TARGET, true); // CraftBukkit
this.targetMob = null;
}
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/ai/sensing/Sensor.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/ai/sensing/Sensor.java.patch
index a052e1e5a2..c74a750263 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/ai/sensing/Sensor.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/ai/sensing/Sensor.java.patch
@@ -1,12 +1,10 @@
--- a/net/minecraft/world/entity/ai/sensing/Sensor.java
+++ b/net/minecraft/world/entity/ai/sensing/Sensor.java
-@@ -29,8 +_,19 @@
+@@ -29,8 +_,17 @@
.ignoreInvisibilityTesting();
private final int scanRate;
private long timeToTick;
-+ // Paper start - configurable sensor tick rate and timings
-+ private final String configKey;
-+ // Paper end
++ private final String configKey; // Paper - configurable sensor tick rate and timings
public Sensor(int scanRate) {
+ // Paper start - configurable sensor tick rate and timings
@@ -20,14 +18,12 @@
this.scanRate = scanRate;
this.timeToTick = RANDOM.nextInt(scanRate);
}
-@@ -41,7 +_,9 @@
+@@ -41,7 +_,7 @@
public final void tick(ServerLevel level, E entity) {
if (--this.timeToTick <= 0L) {
- this.timeToTick = this.scanRate;
-+ // Paper start - configurable sensor tick rate and timings
-+ this.timeToTick = java.util.Objects.requireNonNullElse(level.paperConfig().tickRates.sensor.get(entity.getType(), this.configKey), this.scanRate);
-+ // Paper end
++ this.timeToTick = java.util.Objects.requireNonNullElse(level.paperConfig().tickRates.sensor.get(entity.getType(), this.configKey), this.scanRate); // Paper - configurable sensor tick rate and timings
this.updateTargetingConditionRanges(entity);
this.doTick(level, entity);
}