Add Configuration for vertical Despawn Ranges (#11279)

This commit is contained in:
Tamion 2024-08-17 21:13:10 +02:00 committed by GitHub
parent 52ae4ad466
commit 75655ec1d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 139 additions and 43 deletions

View File

@ -854,10 +854,10 @@ index 0000000000000000000000000000000000000000..69add4a7f1147015806bc9b63a8340d1
+} +}
diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..783eac6e458c6f1a0584301fb84a2fe341868f34 index 0000000000000000000000000000000000000000..715d572351c295cd48c558bb1dfbef6126fc51d0
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java +++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java
@@ -0,0 +1,466 @@ @@ -0,0 +1,468 @@
+package io.papermc.paper.configuration; +package io.papermc.paper.configuration;
+ +
+import com.google.common.base.Suppliers; +import com.google.common.base.Suppliers;
@ -885,6 +885,7 @@ index 0000000000000000000000000000000000000000..783eac6e458c6f1a0584301fb84a2fe3
+import io.papermc.paper.configuration.transformation.world.versioned.V30_RenameFilterNbtFromSpawnEgg; +import io.papermc.paper.configuration.transformation.world.versioned.V30_RenameFilterNbtFromSpawnEgg;
+import io.papermc.paper.configuration.transformation.world.versioned.V31_SpawnLoadedRangeToGameRule; +import io.papermc.paper.configuration.transformation.world.versioned.V31_SpawnLoadedRangeToGameRule;
+import io.papermc.paper.configuration.type.BooleanOrDefault; +import io.papermc.paper.configuration.type.BooleanOrDefault;
+import io.papermc.paper.configuration.type.DespawnRange;
+import io.papermc.paper.configuration.type.Duration; +import io.papermc.paper.configuration.type.Duration;
+import io.papermc.paper.configuration.type.DurationOrDisabled; +import io.papermc.paper.configuration.type.DurationOrDisabled;
+import io.papermc.paper.configuration.type.EngineMode; +import io.papermc.paper.configuration.type.EngineMode;
@ -1095,6 +1096,7 @@ index 0000000000000000000000000000000000000000..783eac6e458c6f1a0584301fb84a2fe3
+ .register(new TypeToken<Reference2IntMap<?>>() {}, new FastutilMapSerializer.SomethingToPrimitive<Reference2IntMap<?>>(Reference2IntOpenHashMap::new, Integer.TYPE)) + .register(new TypeToken<Reference2IntMap<?>>() {}, new FastutilMapSerializer.SomethingToPrimitive<Reference2IntMap<?>>(Reference2IntOpenHashMap::new, Integer.TYPE))
+ .register(new TypeToken<Reference2LongMap<?>>() {}, new FastutilMapSerializer.SomethingToPrimitive<Reference2LongMap<?>>(Reference2LongOpenHashMap::new, Long.TYPE)) + .register(new TypeToken<Reference2LongMap<?>>() {}, new FastutilMapSerializer.SomethingToPrimitive<Reference2LongMap<?>>(Reference2LongOpenHashMap::new, Long.TYPE))
+ .register(new TypeToken<Table<?, ?, ?>>() {}, new TableSerializer()) + .register(new TypeToken<Table<?, ?, ?>>() {}, new TableSerializer())
+ .register(DespawnRange.class, DespawnRange.SERIALIZER)
+ .register(StringRepresentableSerializer::isValidFor, new StringRepresentableSerializer()) + .register(StringRepresentableSerializer::isValidFor, new StringRepresentableSerializer())
+ .register(IntOr.Default.SERIALIZER) + .register(IntOr.Default.SERIALIZER)
+ .register(IntOr.Disabled.SERIALIZER) + .register(IntOr.Disabled.SERIALIZER)
@ -1414,10 +1416,10 @@ index 0000000000000000000000000000000000000000..990d1bb46e0f9719f4e9af928d80ac6f
+} +}
diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..4bcf27f98765abf693e535cfc1756c27a10cb316 index 0000000000000000000000000000000000000000..95e96fe8aa93efbbb2e0a7dd98377fdc4fe0e6dd
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
@@ -0,0 +1,554 @@ @@ -0,0 +1,561 @@
+package io.papermc.paper.configuration; +package io.papermc.paper.configuration;
+ +
+import com.google.common.collect.HashBasedTable; +import com.google.common.collect.HashBasedTable;
@ -1429,6 +1431,7 @@ index 0000000000000000000000000000000000000000..4bcf27f98765abf693e535cfc1756c27
+import io.papermc.paper.configuration.serializer.NbtPathSerializer; +import io.papermc.paper.configuration.serializer.NbtPathSerializer;
+import io.papermc.paper.configuration.transformation.world.FeatureSeedsGeneration; +import io.papermc.paper.configuration.transformation.world.FeatureSeedsGeneration;
+import io.papermc.paper.configuration.type.BooleanOrDefault; +import io.papermc.paper.configuration.type.BooleanOrDefault;
+import io.papermc.paper.configuration.type.DespawnRange;
+import io.papermc.paper.configuration.type.Duration; +import io.papermc.paper.configuration.type.Duration;
+import io.papermc.paper.configuration.type.DurationOrDisabled; +import io.papermc.paper.configuration.type.DurationOrDisabled;
+import io.papermc.paper.configuration.type.EngineMode; +import io.papermc.paper.configuration.type.EngineMode;
@ -1603,12 +1606,18 @@ index 0000000000000000000000000000000000000000..4bcf27f98765abf693e535cfc1756c27
+ @MergeMap + @MergeMap
+ public Reference2IntMap<MobCategory> spawnLimits = Util.make(new Reference2IntOpenHashMap<>(NaturalSpawner.SPAWNING_CATEGORIES.length), map -> Arrays.stream(NaturalSpawner.SPAWNING_CATEGORIES).forEach(mobCategory -> map.put(mobCategory, -1))); + public Reference2IntMap<MobCategory> spawnLimits = Util.make(new Reference2IntOpenHashMap<>(NaturalSpawner.SPAWNING_CATEGORIES.length), map -> Arrays.stream(NaturalSpawner.SPAWNING_CATEGORIES).forEach(mobCategory -> map.put(mobCategory, -1)));
+ @MergeMap + @MergeMap
+ public Map<MobCategory, DespawnRange> despawnRanges = Arrays.stream(MobCategory.values()).collect(Collectors.toMap(Function.identity(), category -> new DespawnRange(category.getNoDespawnDistance(), category.getDespawnDistance()))); + public Map<MobCategory, DespawnRangePair> despawnRanges = Arrays.stream(MobCategory.values()).collect(Collectors.toMap(Function.identity(), category -> DespawnRangePair.createDefault()));
+ @MergeMap + @MergeMap
+ public Reference2IntMap<MobCategory> ticksPerSpawn = Util.make(new Reference2IntOpenHashMap<>(NaturalSpawner.SPAWNING_CATEGORIES.length), map -> Arrays.stream(NaturalSpawner.SPAWNING_CATEGORIES).forEach(mobCategory -> map.put(mobCategory, -1))); + public Reference2IntMap<MobCategory> ticksPerSpawn = Util.make(new Reference2IntOpenHashMap<>(NaturalSpawner.SPAWNING_CATEGORIES.length), map -> Arrays.stream(NaturalSpawner.SPAWNING_CATEGORIES).forEach(mobCategory -> map.put(mobCategory, -1)));
+ +
+ @ConfigSerializable + @ConfigSerializable
+ public record DespawnRange(@Required int soft, @Required int hard) { + public record DespawnRangePair(@Required DespawnRange hard, @Required DespawnRange soft) {
+ public static DespawnRangePair createDefault() {
+ return new DespawnRangePair(
+ new DespawnRange(IntOr.Default.USE_DEFAULT),
+ new DespawnRange(IntOr.Default.USE_DEFAULT)
+ );
+ }
+ } + }
+ +
+ public WaterAnimalSpawnHeight wateranimalSpawnHeight; + public WaterAnimalSpawnHeight wateranimalSpawnHeight;
@ -2841,7 +2850,7 @@ index 0000000000000000000000000000000000000000..4af710e144b70933d750c22edfe484c1
+} +}
diff --git a/src/main/java/io/papermc/paper/configuration/serializer/collections/MapSerializer.java b/src/main/java/io/papermc/paper/configuration/serializer/collections/MapSerializer.java diff --git a/src/main/java/io/papermc/paper/configuration/serializer/collections/MapSerializer.java b/src/main/java/io/papermc/paper/configuration/serializer/collections/MapSerializer.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..9b5075c39a4ef931cdb99e9aee8a33c6d88c2a2e index 0000000000000000000000000000000000000000..e7e997796ec47c742cc1f98e61db75a4231e6f98
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/configuration/serializer/collections/MapSerializer.java +++ b/src/main/java/io/papermc/paper/configuration/serializer/collections/MapSerializer.java
@@ -0,0 +1,162 @@ @@ -0,0 +1,162 @@
@ -2933,7 +2942,7 @@ index 0000000000000000000000000000000000000000..9b5075c39a4ef931cdb99e9aee8a33c6
+ return serializer.deserialize(type, node); + return serializer.deserialize(type, node);
+ } catch (SerializationException ex) { + } catch (SerializationException ex) {
+ ex.initPath(node::path); + ex.initPath(node::path);
+ LOGGER.error("Could not deserialize {} {} into {} at {}", mapPart, node.raw(), type, path); + LOGGER.error("Could not deserialize {} {} into {} at {}: {}", mapPart, node.raw(), type, path, ex.rawMessage());
+ } + }
+ return null; + return null;
+ } + }
@ -2994,7 +3003,7 @@ index 0000000000000000000000000000000000000000..9b5075c39a4ef931cdb99e9aee8a33c6
+ return true; + return true;
+ } catch (SerializationException ex) { + } catch (SerializationException ex) {
+ ex.initPath(node::path); + ex.initPath(node::path);
+ LOGGER.error("Could not serialize {} {} from {} at {}", mapPart, object, type, path); + LOGGER.error("Could not serialize {} {} from {} at {}: {}", mapPart, object, type, path, ex.rawMessage());
+ } + }
+ return false; + return false;
+ } + }
@ -4190,6 +4199,70 @@ index 0000000000000000000000000000000000000000..a3eaa47cfcfc4fd2a607f9b375230fad
+ } + }
+ } + }
+} +}
diff --git a/src/main/java/io/papermc/paper/configuration/type/DespawnRange.java b/src/main/java/io/papermc/paper/configuration/type/DespawnRange.java
new file mode 100644
index 0000000000000000000000000000000000000000..8f55258ecc8bfd2ab4e08f31562f7b3bde5c766b
--- /dev/null
+++ b/src/main/java/io/papermc/paper/configuration/type/DespawnRange.java
@@ -0,0 +1,58 @@
+package io.papermc.paper.configuration.type;
+
+import io.papermc.paper.configuration.type.number.IntOr;
+import java.lang.reflect.Type;
+import org.checkerframework.checker.nullness.qual.Nullable;
+import org.spongepowered.configurate.ConfigurationNode;
+import org.spongepowered.configurate.objectmapping.meta.Required;
+import org.spongepowered.configurate.serialize.SerializationException;
+import org.spongepowered.configurate.serialize.TypeSerializer;
+
+public record DespawnRange(
+ @Required IntOr.Default horizontalLimit,
+ @Required IntOr.Default verticalLimit,
+ @Required boolean wasDefinedViaLongSyntax
+) {
+
+ public DespawnRange(final IntOr.Default generalLimit) {
+ this(generalLimit, generalLimit, false);
+ }
+
+ public static final TypeSerializer<DespawnRange> SERIALIZER = new Serializer();
+
+ static final class Serializer implements TypeSerializer<DespawnRange> {
+
+ public static final String HORIZONTAL = "horizontal";
+ public static final String VERTICAL = "vertical";
+
+ @Override
+ public DespawnRange deserialize(final Type type, final ConfigurationNode node) throws SerializationException {
+ if (node.hasChild(HORIZONTAL) && node.hasChild(VERTICAL)) {
+ return new DespawnRange(
+ node.node(HORIZONTAL).require(IntOr.Default.class),
+ node.node(VERTICAL).require(IntOr.Default.class),
+ true
+ );
+ } else if (node.hasChild(HORIZONTAL) || node.hasChild(VERTICAL)) {
+ throw new SerializationException(node, DespawnRange.class, "Expected both horizontal and vertical despawn ranges to be defined");
+ } else {
+ return new DespawnRange(node.require(IntOr.Default.class));
+ }
+ }
+
+ @Override
+ public void serialize(final Type type, final @Nullable DespawnRange despawnRange, final ConfigurationNode node) throws SerializationException {
+ if (despawnRange == null) {
+ node.raw(null);
+ return;
+ }
+
+ if (despawnRange.wasDefinedViaLongSyntax()) {
+ node.node(HORIZONTAL).set(despawnRange.horizontalLimit());
+ node.node(VERTICAL).set(despawnRange.verticalLimit());
+ } else {
+ node.set(despawnRange.verticalLimit());
+ }
+ }
+ }
+}
diff --git a/src/main/java/io/papermc/paper/configuration/type/Duration.java b/src/main/java/io/papermc/paper/configuration/type/Duration.java diff --git a/src/main/java/io/papermc/paper/configuration/type/Duration.java b/src/main/java/io/papermc/paper/configuration/type/Duration.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..422ccb0b332b3e94be228b9b94f379467d6461a5 index 0000000000000000000000000000000000000000..422ccb0b332b3e94be228b9b94f379467d6461a5

View File

@ -5,23 +5,46 @@ Subject: [PATCH] Add configurable entity despawn distances
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 0593d828c911c94c9833bf12b9c294e5dac1f4e8..5fd0e3d27f3c86f1ff767b45dfa6138c30f13e3e 100644 index 0593d828c911c94c9833bf12b9c294e5dac1f4e8..e672b04e9e123caecec30645df8858d6eda4c931 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -864,14 +864,14 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @@ -863,20 +863,27 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
Player entityhuman = this.level().getNearestPlayer(this, -1.0D);
if (entityhuman != null) { if (entityhuman != null) {
double d0 = entityhuman.distanceToSqr((Entity) this); - double d0 = entityhuman.distanceToSqr((Entity) this);
- int i = this.getType().getCategory().getDespawnDistance(); - int i = this.getType().getCategory().getDespawnDistance();
+ int i = this.level().paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory()).hard(); // Paper - Configurable despawn distances - int j = i * i;
int j = i * i; -
- if (d0 > (double) j && this.removeWhenFarAway(d0)) {
if (d0 > (double) j && this.removeWhenFarAway(d0)) { + // Paper start - Configurable despawn distances
+ // Read configration data and square it for later comparison
+ final MobCategory category = this.getType().getCategory();
+ final io.papermc.paper.configuration.WorldConfiguration.Entities.Spawning.DespawnRangePair despawnRangePair = this.level().paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory());
+ final int hardHorizontalLimitSquared = (int) Math.pow(despawnRangePair.hard().horizontalLimit().or(category.getDespawnDistance()), 2);
+ final int softHorizontalLimitSquared = (int) Math.pow(despawnRangePair.soft().horizontalLimit().or(category.getNoDespawnDistance()), 2);
+ final int hardVerticalLimit = despawnRangePair.hard().verticalLimit().or(category.getDespawnDistance());
+ final int softVerticalLimit = despawnRangePair.soft().verticalLimit().or(category.getNoDespawnDistance());
+ // Compute vertical/horizontal distances
+ final double horizontalDistanceSquared = entityhuman.distanceToSqr(this.getX(), entityhuman.getY(), this.getZ());
+ final double verticalDistance = Math.abs(entityhuman.getY() - this.getY());
+ // Despawn if hard/soft limit is exceeded
+ if ((horizontalDistanceSquared > hardHorizontalLimitSquared || verticalDistance > hardVerticalLimit) && this.removeWhenFarAway(horizontalDistanceSquared)) {
this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
} }
-
- int k = this.getType().getCategory().getNoDespawnDistance(); - int k = this.getType().getCategory().getNoDespawnDistance();
+ int k = this.level().paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory()).soft(); // Paper - Configurable despawn distances - int l = k * k;
int l = k * k; -
- if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && d0 > (double) l && this.removeWhenFarAway(d0)) {
if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && d0 > (double) l && this.removeWhenFarAway(d0)) { - this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
- } else if (d0 < (double) l) {
+ if (horizontalDistanceSquared > softHorizontalLimitSquared || verticalDistance > softVerticalLimit) {
+ if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && this.removeWhenFarAway(horizontalDistanceSquared)) {
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
+ }
+ } else {
+ // Paper end - Configurable despawn distances
this.noActionTime = 0;
}
}

View File

@ -21,7 +21,7 @@ index 3126e8cab3c40e3af47f4c8925e1c6a9523309ba..3207166061bf9c4d7bf3f38e5a9f7aff
public static Predicate<Entity> withinDistance(double x, double y, double z, double max) { public static Predicate<Entity> withinDistance(double x, double y, double z, double max) {
double d4 = max * max; double d4 = max * max;
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 5fd0e3d27f3c86f1ff767b45dfa6138c30f13e3e..a753fd0434f611d8c77270012e383e3210f1194b 100644 index 4ce1586351b417aede1fd401907388b5fa0e9fd6..d8beadc96a7f779c39c8e22ffe52d872ac49a0ad 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -860,7 +860,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @@ -860,7 +860,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@ -32,7 +32,7 @@ index 5fd0e3d27f3c86f1ff767b45dfa6138c30f13e3e..a753fd0434f611d8c77270012e383e32
+ Player entityhuman = this.level().findNearbyPlayer(this, -1.0D, EntitySelector.PLAYER_AFFECTS_SPAWNING); // Paper - Affects Spawning API + Player entityhuman = this.level().findNearbyPlayer(this, -1.0D, EntitySelector.PLAYER_AFFECTS_SPAWNING); // Paper - Affects Spawning API
if (entityhuman != null) { if (entityhuman != null) {
double d0 = entityhuman.distanceToSqr((Entity) this); // Paper start - Configurable despawn distances
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java b/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java b/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java
index 3b7fc11b7832a72fb9b0806fe9847f4e30759e7b..3cb84856c10347162a8736ae1ef65165183ec8fe 100644 index 3b7fc11b7832a72fb9b0806fe9847f4e30759e7b..3cb84856c10347162a8736ae1ef65165183ec8fe 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java --- a/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Item#canEntityPickup
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index a753fd0434f611d8c77270012e383e3210f1194b..55aecada617bd84676928a7818f1511b2d85e7bf 100644 index d8beadc96a7f779c39c8e22ffe52d872ac49a0ad..fe00b73b0aeac4e4c1496dcaf81595f57a4a073f 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -673,6 +673,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @@ -673,6 +673,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab

View File

@ -93,10 +93,10 @@ index cccc60602360f25f0aeddbd16dad2bb63a1728a8..ada79af49d1cafe25ca6c1fb456e1c4c
} }
} }
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 55aecada617bd84676928a7818f1511b2d85e7bf..f56d431207323a80b7f566ac6e30eebf232ee695 100644 index b076a6f4710c125767cea374c384228354854e02..4dbd8a3425058692600e6a1493cd5531df20fa72 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1691,7 +1691,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @@ -1698,7 +1698,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
if (f1 > 0.0F && target instanceof LivingEntity) { if (f1 > 0.0F && target instanceof LivingEntity) {
LivingEntity entityliving = (LivingEntity) target; LivingEntity entityliving = (LivingEntity) target;
@ -273,7 +273,7 @@ index 6476c644d3da824c5ee4190cb45cde678ff1188f..b216140a8be65e210250358af8daf493
// CraftBukkit end // CraftBukkit end
entity.setDeltaMovement(entity.getDeltaMovement().add(vec3d1)); entity.setDeltaMovement(entity.getDeltaMovement().add(vec3d1));
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index cfdabb93c2d30845af9108552ed9bee9929250ce..e1b7bd5c23ba79b84ad257b7fb45e251da3978e5 100644 index cfdabb93c2d30845af9108552ed9bee9929250ce..9225746382bcecb0bab655a8232fecc09169225d 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1922,19 +1922,33 @@ public class CraftEventFactory { @@ -1922,19 +1922,33 @@ public class CraftEventFactory {

View File

@ -19,7 +19,7 @@ public net.minecraft.world.entity.LivingEntity getDeathSound()Lnet/minecraft/sou
public net.minecraft.world.entity.LivingEntity getSoundVolume()F public net.minecraft.world.entity.LivingEntity getSoundVolume()F
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index a3a1450949703851625bbb257e92b3be4d79a06a..ff3f70b8c266dc3b2ab374ffd6905ecbfe8510be 100644 index 0dee94f1dd27a0d7e709367450c5ef7956e27217..fa8640f961b93dc811296131dfda58faa1908add 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -269,6 +269,10 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @@ -269,6 +269,10 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
@ -80,7 +80,7 @@ index a3a1450949703851625bbb257e92b3be4d79a06a..ff3f70b8c266dc3b2ab374ffd6905ecb
} }
} }
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index f7a77b31dc196823510f96bd3b2344058e20feac..279fa00fd9043e1995f22c79f47d0b41c27bd933 100644 index 39dff0a38b53624c935f27cc86ff036c831f407f..bdee5725029eda3a0e7bee407286480c0bb47db1 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -283,6 +283,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -283,6 +283,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@ -229,10 +229,10 @@ index f7a77b31dc196823510f96bd3b2344058e20feac..279fa00fd9043e1995f22c79f47d0b41
public int getExpReward(@Nullable Entity entity) { // CraftBukkit public int getExpReward(@Nullable Entity entity) { // CraftBukkit
Level world = this.level(); Level world = this.level();
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index f56d431207323a80b7f566ac6e30eebf232ee695..c2b10c3dba9d4d08e48f8e8836142b85f16b14cb 100644 index 4dbd8a3425058692600e6a1493cd5531df20fa72..2c00746ac5394ea3c292d214ee595cdf42d75cfd 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1119,6 +1119,12 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @@ -1126,6 +1126,12 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
} }
@ -245,7 +245,7 @@ index f56d431207323a80b7f566ac6e30eebf232ee695..c2b10c3dba9d4d08e48f8e8836142b85
@Override @Override
protected void dropCustomDeathLoot(ServerLevel world, DamageSource source, boolean causedByPlayer) { protected void dropCustomDeathLoot(ServerLevel world, DamageSource source, boolean causedByPlayer) {
super.dropCustomDeathLoot(world, source, causedByPlayer); super.dropCustomDeathLoot(world, source, causedByPlayer);
@@ -1127,6 +1133,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @@ -1134,6 +1140,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
for (int j = 0; j < i; ++j) { for (int j = 0; j < i; ++j) {
EquipmentSlot enumitemslot = aenumitemslot[j]; EquipmentSlot enumitemslot = aenumitemslot[j];
@ -253,7 +253,7 @@ index f56d431207323a80b7f566ac6e30eebf232ee695..c2b10c3dba9d4d08e48f8e8836142b85
ItemStack itemstack = this.getItemBySlot(enumitemslot); ItemStack itemstack = this.getItemBySlot(enumitemslot);
float f = this.getEquipmentDropChance(enumitemslot); float f = this.getEquipmentDropChance(enumitemslot);
@@ -1151,7 +1158,13 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @@ -1158,7 +1165,13 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
} }
this.spawnAtLocation(itemstack); this.spawnAtLocation(itemstack);
@ -423,7 +423,7 @@ index ee3902cbada46ffb78c42dbf6f00c859546c76e1..92bb0c63330ad3a4cb13b2dc65502071
// CraftBukkit end // CraftBukkit end
this.gameEvent(GameEvent.ENTITY_DIE); this.gameEvent(GameEvent.ENTITY_DIE);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 92f9502a2d5721ebb1757a069a0f138db66628d7..6c5bd88777ff79c7408cf5ffed0f099a79e5429a 100644 index a7e611aaeb457820ad303b95822d8ea86b060477..004ac565d4124f6059d530034cf0c9a28f0be467 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2517,7 +2517,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2517,7 +2517,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -443,7 +443,7 @@ index 92f9502a2d5721ebb1757a069a0f138db66628d7..6c5bd88777ff79c7408cf5ffed0f099a
public void injectScaledMaxHealth(Collection<AttributeInstance> collection, boolean force) { public void injectScaledMaxHealth(Collection<AttributeInstance> collection, boolean force) {
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index d1b473ef83df0ed4ae7cd9dd0525dac5e8a41223..a9a2b35378d6654ba00a48737f596553445214aa 100644 index d63cf5933fdcff6d71c7ddbfed3640acd1646b70..1f4c686e92e7449556ee5067553ed4473ba2f50e 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -901,9 +901,16 @@ public class CraftEventFactory { @@ -901,9 +901,16 @@ public class CraftEventFactory {

View File

@ -78,10 +78,10 @@ index 30d7dd9646ba9d6a9396dc140a61eb2cac07dfc6..bc03f1fe2a311bf61449879751360c67
default void closeRangeLeashBehaviour(Entity entity) {} default void closeRangeLeashBehaviour(Entity entity) {}
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index c2b10c3dba9d4d08e48f8e8836142b85f16b14cb..37a8e426ca65587863bd22d2b7f32fae854c322e 100644 index 2c00746ac5394ea3c292d214ee595cdf42d75cfd..0048433e06bb1ec5176dc5b81afc9bfead3591f0 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1617,8 +1617,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @@ -1624,8 +1624,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
boolean flag1 = super.startRiding(entity, force); boolean flag1 = super.startRiding(entity, force);
if (flag1 && this.isLeashed()) { if (flag1 && this.isLeashed()) {
@ -121,7 +121,7 @@ index 3c0af74ed65610b1d5e3b72fdcf28c5a3423f0da..01173fc7177d78588978e087e63efda0
flag1 = true; flag1 = true;
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 97a17f2b782196b51ebbc6740aad1768fc73f7ba..2786398e99af94d8dc1251009cdb5fa71206bcf3 100644 index 6e5bfdc0a5b39977c4550876470c9a2534160056..e3cf4febcb51db96fcd162b2af77dd92e7d49365 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1596,8 +1596,10 @@ public class CraftEventFactory { @@ -1596,8 +1596,10 @@ public class CraftEventFactory {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Fix silent equipment change for mobs
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 37a8e426ca65587863bd22d2b7f32fae854c322e..1a2efd8b77d65606994f13980ddbe018f90d0c35 100644 index 0048433e06bb1ec5176dc5b81afc9bfead3591f0..3f9c2a2478b84ee59f43ff9e48e2644db8a14dd7 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -1102,19 +1102,26 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @@ -1109,19 +1109,26 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@Override @Override
public void setItemSlot(EquipmentSlot slot, ItemStack stack) { public void setItemSlot(EquipmentSlot slot, ItemStack stack) {

View File

@ -66,7 +66,7 @@ index b98f9246b60daf31460f41ce214dfa7c011f5684..842b0cec0397d7ae5166617627340ffa
@Nullable @Nullable
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index ff16c7196b146388c526e3100e561be771ca8a91..cbf076c5fa69d32ad3c8ea759cd9d405b60f8663 100644 index 278e22985ecda6653ce01a29209eb51506c48438..474868d362d855423f74fd604c1050cf33ba27f3 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -887,11 +887,13 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -887,11 +887,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
@ -84,7 +84,7 @@ index ff16c7196b146388c526e3100e561be771ca8a91..cbf076c5fa69d32ad3c8ea759cd9d405
if (nbt.contains("Brain", 10)) { if (nbt.contains("Brain", 10)) {
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 1a2efd8b77d65606994f13980ddbe018f90d0c35..8b6eed30f84dc98878deaa805e7446ae4b168400 100644 index 7e26c530783b63f9abbd3a016196e6be06dcd822..fc929c2d306a18e52e41fa4d1ee0badd1ed0bb91 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -603,7 +603,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @@ -603,7 +603,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab

View File

@ -147,7 +147,7 @@ index 9928c5f0814aa2206dfe7540a3fe2465b4446359..32502664a82dda6220f8d9fa55410574
movement = this.maybeBackOffFromEdge(movement, movementType); movement = this.maybeBackOffFromEdge(movement, movementType);
Vec3 vec3d1 = this.collide(movement); Vec3 vec3d1 = this.collide(movement);
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index 8b6eed30f84dc98878deaa805e7446ae4b168400..bd7c6ce15698aed70376c109ba36f52d6794a2f8 100644 index fc929c2d306a18e52e41fa4d1ee0badd1ed0bb91..ebd8e5ff9f80157dd6029456f165265d04932422 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java --- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -232,6 +232,19 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @@ -232,6 +232,19 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab