2021-06-11 14:02:28 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 13 May 2016 01:38:06 -0400
Subject: [PATCH] Entity Activation Range 2.0
Optimizes performance of Activation Range
Adds many new configurations and a new wake up inactive system
Fixes and adds new Immunities to improve gameplay behavior
Adds water Mobs to activation range config and nerfs fish
Adds flying monsters to control ghast and phantoms
Adds villagers as separate config
2024-12-16 14:08:25 +01:00
diff --git a/io/papermc/paper/entity/activation/ActivationRange.java b/io/papermc/paper/entity/activation/ActivationRange.java
new file mode 100644
2025-04-12 17:26:44 +02:00
index 0000000000000000000000000000000000000000..2ebee223085fe7926c7f3e555df19ae69f36157e
2024-12-16 14:08:25 +01:00
--- /dev/null
+++ b/io/papermc/paper/entity/activation/ActivationRange.java
@@ -0,0 +1,318 @@
+package io.papermc.paper.entity.activation;
+
+import net.minecraft.core.BlockPos;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.world.entity.Entity;
+import net.minecraft.world.entity.ExperienceOrb;
+import net.minecraft.world.entity.FlyingMob;
+import net.minecraft.world.entity.LightningBolt;
+import net.minecraft.world.entity.LivingEntity;
+import net.minecraft.world.entity.Mob;
+import net.minecraft.world.entity.ai.Brain;
+import net.minecraft.world.entity.animal.Animal;
+import net.minecraft.world.entity.animal.Bee;
2025-04-12 17:26:44 +02:00
+import net.minecraft.world.entity.animal.sheep.Sheep;
2024-12-16 14:08:25 +01:00
+import net.minecraft.world.entity.animal.horse.Llama;
+import net.minecraft.world.entity.boss.EnderDragonPart;
+import net.minecraft.world.entity.boss.enderdragon.EndCrystal;
+import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
+import net.minecraft.world.entity.boss.wither.WitherBoss;
+import net.minecraft.world.entity.item.ItemEntity;
+import net.minecraft.world.entity.item.PrimedTnt;
+import net.minecraft.world.entity.monster.Creeper;
+import net.minecraft.world.entity.monster.Pillager;
+import net.minecraft.world.entity.npc.Villager;
+import net.minecraft.world.entity.player.Player;
+import net.minecraft.world.entity.projectile.AbstractArrow;
+import net.minecraft.world.entity.projectile.AbstractHurtingProjectile;
+import net.minecraft.world.entity.projectile.EyeOfEnder;
+import net.minecraft.world.entity.projectile.FireworkRocketEntity;
+import net.minecraft.world.entity.projectile.ThrowableProjectile;
+import net.minecraft.world.entity.projectile.ThrownTrident;
+import net.minecraft.world.entity.schedule.Activity;
+import net.minecraft.world.level.Level;
+import net.minecraft.world.phys.AABB;
+import org.spigotmc.SpigotWorldConfig;
+
+public final class ActivationRange {
+
+ private ActivationRange() {
+ }
+
+ static Activity[] VILLAGER_PANIC_IMMUNITIES = {
+ Activity.HIDE,
+ Activity.PRE_RAID,
+ Activity.RAID,
+ Activity.PANIC
+ };
+
+ private static int checkInactiveWakeup(final Entity entity) {
+ final Level world = entity.level();
+ final SpigotWorldConfig config = world.spigotConfig;
+ final long inactiveFor = MinecraftServer.currentTick - entity.activatedTick;
+ if (entity.activationType == ActivationType.VILLAGER) {
+ if (inactiveFor > config.wakeUpInactiveVillagersEvery && world.wakeupInactiveRemainingVillagers > 0) {
+ world.wakeupInactiveRemainingVillagers--;
+ return config.wakeUpInactiveVillagersFor;
+ }
+ } else if (entity.activationType == ActivationType.ANIMAL) {
+ if (inactiveFor > config.wakeUpInactiveAnimalsEvery && world.wakeupInactiveRemainingAnimals > 0) {
+ world.wakeupInactiveRemainingAnimals--;
+ return config.wakeUpInactiveAnimalsFor;
+ }
+ } else if (entity.activationType == ActivationType.FLYING_MONSTER) {
+ if (inactiveFor > config.wakeUpInactiveFlyingEvery && world.wakeupInactiveRemainingFlying > 0) {
+ world.wakeupInactiveRemainingFlying--;
+ return config.wakeUpInactiveFlyingFor;
+ }
+ } else if (entity.activationType == ActivationType.MONSTER || entity.activationType == ActivationType.RAIDER) {
+ if (inactiveFor > config.wakeUpInactiveMonstersEvery && world.wakeupInactiveRemainingMonsters > 0) {
+ world.wakeupInactiveRemainingMonsters--;
+ return config.wakeUpInactiveMonstersFor;
+ }
+ }
+ return -1;
+ }
+
+ static AABB maxBB = new AABB(0, 0, 0, 0, 0, 0);
+
+ /**
+ * These entities are excluded from Activation range checks.
+ *
+ * @param entity
+ * @param config
+ * @return boolean If it should always tick.
+ */
+ public static boolean initializeEntityActivationState(final Entity entity, final SpigotWorldConfig config) {
2025-01-31 13:13:14 +01:00
+ return (entity.activationType == ActivationType.MISC && config.miscActivationRange <= 0)
+ || (entity.activationType == ActivationType.RAIDER && config.raiderActivationRange <= 0)
+ || (entity.activationType == ActivationType.ANIMAL && config.animalActivationRange <= 0)
+ || (entity.activationType == ActivationType.MONSTER && config.monsterActivationRange <= 0)
2024-12-16 14:08:25 +01:00
+ || (entity.activationType == ActivationType.VILLAGER && config.villagerActivationRange <= 0)
+ || (entity.activationType == ActivationType.WATER && config.waterActivationRange <= 0)
+ || (entity.activationType == ActivationType.FLYING_MONSTER && config.flyingMonsterActivationRange <= 0)
+ || entity instanceof EyeOfEnder
+ || entity instanceof Player
+ || entity instanceof ThrowableProjectile
+ || entity instanceof EnderDragon
+ || entity instanceof EnderDragonPart
+ || entity instanceof WitherBoss
+ || entity instanceof AbstractHurtingProjectile
+ || entity instanceof LightningBolt
+ || entity instanceof PrimedTnt
+ || entity instanceof net.minecraft.world.entity.item.FallingBlockEntity
+ || entity instanceof net.minecraft.world.entity.vehicle.AbstractMinecart
+ || entity instanceof net.minecraft.world.entity.vehicle.AbstractBoat
+ || entity instanceof EndCrystal
+ || entity instanceof FireworkRocketEntity
+ || entity instanceof ThrownTrident;
+ }
+
+ /**
+ * Find what entities are in range of the players in the world and set
+ * active if in range.
+ *
+ * @param world
+ */
+ public static void activateEntities(final Level world) {
+ final int miscActivationRange = world.spigotConfig.miscActivationRange;
+ final int raiderActivationRange = world.spigotConfig.raiderActivationRange;
+ final int animalActivationRange = world.spigotConfig.animalActivationRange;
+ final int monsterActivationRange = world.spigotConfig.monsterActivationRange;
+ final int waterActivationRange = world.spigotConfig.waterActivationRange;
+ final int flyingActivationRange = world.spigotConfig.flyingMonsterActivationRange;
+ final int villagerActivationRange = world.spigotConfig.villagerActivationRange;
+ world.wakeupInactiveRemainingAnimals = Math.min(world.wakeupInactiveRemainingAnimals + 1, world.spigotConfig.wakeUpInactiveAnimals);
+ world.wakeupInactiveRemainingVillagers = Math.min(world.wakeupInactiveRemainingVillagers + 1, world.spigotConfig.wakeUpInactiveVillagers);
+ world.wakeupInactiveRemainingMonsters = Math.min(world.wakeupInactiveRemainingMonsters + 1, world.spigotConfig.wakeUpInactiveMonsters);
+ world.wakeupInactiveRemainingFlying = Math.min(world.wakeupInactiveRemainingFlying + 1, world.spigotConfig.wakeUpInactiveFlying);
+
+ int maxRange = Math.max(monsterActivationRange, animalActivationRange);
+ maxRange = Math.max(maxRange, raiderActivationRange);
+ maxRange = Math.max(maxRange, miscActivationRange);
+ maxRange = Math.max(maxRange, flyingActivationRange);
+ maxRange = Math.max(maxRange, waterActivationRange);
+ maxRange = Math.max(maxRange, villagerActivationRange);
+ maxRange = Math.min((world.spigotConfig.simulationDistance << 4) - 8, maxRange);
+
+ for (final Player player : world.players()) {
+ player.activatedTick = MinecraftServer.currentTick;
+ if (world.spigotConfig.ignoreSpectatorActivation && player.isSpectator()) {
+ continue;
+ }
+
+ final int worldHeight = world.getHeight();
+ ActivationRange.maxBB = player.getBoundingBox().inflate(maxRange, worldHeight, maxRange);
+ ActivationType.MISC.boundingBox = player.getBoundingBox().inflate(miscActivationRange, worldHeight, miscActivationRange);
+ ActivationType.RAIDER.boundingBox = player.getBoundingBox().inflate(raiderActivationRange, worldHeight, raiderActivationRange);
+ ActivationType.ANIMAL.boundingBox = player.getBoundingBox().inflate(animalActivationRange, worldHeight, animalActivationRange);
+ ActivationType.MONSTER.boundingBox = player.getBoundingBox().inflate(monsterActivationRange, worldHeight, monsterActivationRange);
+ ActivationType.WATER.boundingBox = player.getBoundingBox().inflate(waterActivationRange, worldHeight, waterActivationRange);
+ ActivationType.FLYING_MONSTER.boundingBox = player.getBoundingBox().inflate(flyingActivationRange, worldHeight, flyingActivationRange);
+ ActivationType.VILLAGER.boundingBox = player.getBoundingBox().inflate(villagerActivationRange, worldHeight, villagerActivationRange);
+
+ final java.util.List<Entity> entities = world.getEntities((Entity) null, ActivationRange.maxBB, e -> true);
+ final boolean tickMarkers = world.paperConfig().entities.markers.tick;
+ for (final Entity entity : entities) {
+ if (!tickMarkers && entity instanceof net.minecraft.world.entity.Marker) {
+ continue;
+ }
+
+ ActivationRange.activateEntity(entity);
+ }
+ }
+ }
+
+ /**
+ * Tries to activate an entity.
+ *
+ * @param entity
+ */
+ private static void activateEntity(final Entity entity) {
+ if (MinecraftServer.currentTick > entity.activatedTick) {
+ if (entity.defaultActivationState) {
+ entity.activatedTick = MinecraftServer.currentTick;
+ return;
+ }
+ if (entity.activationType.boundingBox.intersects(entity.getBoundingBox())) {
+ entity.activatedTick = MinecraftServer.currentTick;
+ }
+ }
+ }
+
+ /**
+ * If an entity is not in range, do some more checks to see if we should
+ * give it a shot.
+ *
+ * @param entity
+ * @return
+ */
+ public static int checkEntityImmunities(final Entity entity) { // return # of ticks to get immunity
+ final SpigotWorldConfig config = entity.level().spigotConfig;
+ final int inactiveWakeUpImmunity = checkInactiveWakeup(entity);
+ if (inactiveWakeUpImmunity > -1) {
+ return inactiveWakeUpImmunity;
+ }
+ if (entity.getRemainingFireTicks() > 0) {
+ return 2;
+ }
+ if (entity.activatedImmunityTick >= MinecraftServer.currentTick) {
+ return 1;
+ }
+ final long inactiveFor = MinecraftServer.currentTick - entity.activatedTick;
+ if ((entity.activationType != ActivationType.WATER && entity.isInWater() && entity.isPushedByFluid())) {
+ return 100;
+ }
+ if (!entity.onGround() || entity.getDeltaMovement().horizontalDistanceSqr() > 9.999999747378752E-6D) {
+ return 100;
+ }
+ if (!(entity instanceof final AbstractArrow arrow)) {
+ if ((!entity.onGround() && !(entity instanceof FlyingMob))) {
+ return 10;
+ }
+ } else if (!arrow.isInGround()) {
+ return 1;
+ }
+ // special cases.
+ if (entity instanceof final LivingEntity living) {
+ if (living.onClimbable() || living.jumping || living.hurtTime > 0 || !living.activeEffects.isEmpty() || living.isFreezing()) {
+ return 1;
+ }
+ if (entity instanceof final Mob mob && mob.getTarget() != null) {
+ return 20;
+ }
+ if (entity instanceof final Bee bee) {
+ final BlockPos movingTarget = bee.getMovingTarget();
+ if (bee.isAngry() ||
+ (bee.getHivePos() != null && bee.getHivePos().equals(movingTarget)) ||
+ (bee.getSavedFlowerPos() != null && bee.getSavedFlowerPos().equals(movingTarget))
+ ) {
+ return 20;
+ }
+ }
+ if (entity instanceof final Villager villager) {
+ final Brain<Villager> behaviorController = villager.getBrain();
+
+ if (config.villagersActiveForPanic) {
+ for (final Activity activity : VILLAGER_PANIC_IMMUNITIES) {
+ if (behaviorController.isActive(activity)) {
+ return 20 * 5;
+ }
+ }
+ }
+
+ if (config.villagersWorkImmunityAfter > 0 && inactiveFor >= config.villagersWorkImmunityAfter) {
+ if (behaviorController.isActive(Activity.WORK)) {
+ return config.villagersWorkImmunityFor;
+ }
+ }
+ }
+ if (entity instanceof final Llama llama && llama.inCaravan()) {
+ return 1;
+ }
+ if (entity instanceof final Animal animal) {
+ if (animal.isBaby() || animal.isInLove()) {
+ return 5;
+ }
+ if (entity instanceof final Sheep sheep && sheep.isSheared()) {
+ return 1;
+ }
+ }
+ if (entity instanceof final Creeper creeper && creeper.isIgnited()) { // isExplosive
+ return 20;
+ }
+ if (entity instanceof final Mob mob && mob.targetSelector.hasTasks()) {
+ return 0;
+ }
+ if (entity instanceof final Pillager pillager) {
+ // TODO:?
+ }
+ }
+ // SPIGOT-6644: Otherwise the target refresh tick will be missed
+ if (entity instanceof ExperienceOrb) {
+ return 20;
+ }
+ return -1;
+ }
+
+ /**
+ * Checks if the entity is active for this tick.
+ *
+ * @param entity
+ * @return
+ */
+ public static boolean checkIfActive(final Entity entity) {
+ // Never safe to skip fireworks or item gravity
+ if (entity instanceof FireworkRocketEntity || (entity instanceof ItemEntity && (entity.tickCount + entity.getId()) % 4 == 0)) { // Needed for item gravity, see ItemEntity tick
+ return true;
+ }
+ // special case always immunities
+ // immunize brand-new entities, dead entities, and portal scenarios
+ if (entity.defaultActivationState || entity.tickCount < 20 * 10 || !entity.isAlive() || (entity.portalProcess != null && !entity.portalProcess.hasExpired()) || entity.portalCooldown > 0) {
+ return true;
+ }
+ // immunize leashed entities
+ if (entity instanceof final Mob mob && mob.getLeashHolder() instanceof Player) {
+ return true;
+ }
+
+ boolean isActive = entity.activatedTick >= MinecraftServer.currentTick;
+ entity.isTemporarilyActive = false;
+
+ // Should this entity tick?
+ if (!isActive) {
+ if ((MinecraftServer.currentTick - entity.activatedTick - 1) % 20 == 0) {
+ // Check immunities every 20 ticks.
+ final int immunity = checkEntityImmunities(entity);
+ if (immunity >= 0) {
+ entity.activatedTick = MinecraftServer.currentTick + immunity;
+ } else {
+ entity.isTemporarilyActive = true;
+ }
+ isActive = true;
+ }
+ }
+ // removed the original's dumb tick skipping for active entities
+ return isActive;
+ }
+}
diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java
2025-04-12 17:26:44 +02:00
index 88b81a5fbc88e6240f86c1e780d80eb4b601df8c..00a5ed09caa2689543bd47bcd93d5a6141d0af46 100644
2024-12-16 14:08:25 +01:00
--- a/net/minecraft/server/level/ChunkMap.java
+++ b/net/minecraft/server/level/ChunkMap.java
@@ -4,7 +4,6 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Queues;
-import com.google.common.collect.Sets;
import com.google.common.collect.ImmutableList.Builder;
import com.mojang.datafixers.DataFixer;
import com.mojang.logging.LogUtils;
@@ -19,7 +18,6 @@ import it.unimi.dsi.fastutil.longs.LongIterator;
import it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet;
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
import it.unimi.dsi.fastutil.longs.LongSet;
-import it.unimi.dsi.fastutil.longs.Long2ObjectMap.Entry;
import java.io.IOException;
import java.io.Writer;
import java.nio.file.Path;
2024-12-16 13:03:53 +01:00
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
2025-04-12 17:26:44 +02:00
index 156f7ddc2fdc96b762598bad2a2b21f433518dc0..ef201f4add358fbf1818f3b2ec9e75fe2cce4c8b 100644
2024-12-16 13:03:53 +01:00
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
2025-04-12 17:26:44 +02:00
@@ -544,6 +544,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
2024-12-16 14:08:25 +01:00
profilerFiller.pop();
}
+ io.papermc.paper.entity.activation.ActivationRange.activateEntities(this); // Paper - EAR
this.entityTickList
.forEach(
entity -> {
2025-04-12 17:26:44 +02:00
@@ -982,12 +983,15 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
2025-02-16 11:46:37 -08:00
entity.totalEntityAge++; // Paper - age-like counter for all entities
2024-12-16 14:08:25 +01:00
profilerFiller.push(() -> BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString());
2024-12-16 13:03:53 +01:00
profilerFiller.incrementCounter("tickNonPassenger");
2024-12-16 14:08:25 +01:00
+ final boolean isActive = io.papermc.paper.entity.activation.ActivationRange.checkIfActive(entity); // Paper - EAR 2
2021-06-13 12:29:58 -07:00
+ if (isActive) { // Paper - EAR 2
entity.tick();
entity.postTick(); // CraftBukkit
2024-12-16 13:03:53 +01:00
+ } else {entity.inactiveTick();} // Paper - EAR 2
profilerFiller.pop();
for (Entity entity1 : entity.getPassengers()) {
2024-12-16 14:08:25 +01:00
- this.tickPassenger(entity, entity1);
+ this.tickPassenger(entity, entity1, isActive); // Paper - EAR 2
}
2024-12-21 13:45:04 +01:00
// Paper start - log detailed entity tick information
} finally {
2025-04-12 17:26:44 +02:00
@@ -998,7 +1002,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
2024-12-21 13:45:04 +01:00
// Paper end - log detailed entity tick information
2024-12-16 14:08:25 +01:00
}
- private void tickPassenger(Entity ridingEntity, Entity passengerEntity) {
+ private void tickPassenger(Entity ridingEntity, Entity passengerEntity, final boolean isActive) { // Paper - EAR 2
if (passengerEntity.isRemoved() || passengerEntity.getVehicle() != ridingEntity) {
passengerEntity.stopRiding();
} else if (passengerEntity instanceof Player || this.entityTickList.contains(passengerEntity)) {
2025-04-12 17:26:44 +02:00
@@ -1008,12 +1012,21 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
2024-12-16 14:08:25 +01:00
ProfilerFiller profilerFiller = Profiler.get();
profilerFiller.push(() -> BuiltInRegistries.ENTITY_TYPE.getKey(passengerEntity.getType()).toString());
profilerFiller.incrementCounter("tickPassenger");
+ // Paper start - EAR 2
+ if (isActive) {
passengerEntity.rideTick();
passengerEntity.postTick(); // CraftBukkit
+ } else {
+ passengerEntity.setDeltaMovement(Vec3.ZERO);
+ passengerEntity.inactiveTick();
+ // copied from inside of if (isPassenger()) of passengerTick, but that ifPassenger is unnecessary
+ ridingEntity.positionRider(passengerEntity);
+ }
+ // Paper end - EAR 2
profilerFiller.pop();
for (Entity entity : passengerEntity.getPassengers()) {
- this.tickPassenger(passengerEntity, entity);
+ this.tickPassenger(passengerEntity, entity, isActive); // Paper - EAR 2
}
}
}
diff --git a/net/minecraft/world/entity/AgeableMob.java b/net/minecraft/world/entity/AgeableMob.java
2025-04-12 17:26:44 +02:00
index f9cfa9dd17bd259cfbc0d96bf48a17556b365d8b..201c6d6e2f5799a7678b16f01c85508bc72e8af5 100644
2024-12-16 14:08:25 +01:00
--- a/net/minecraft/world/entity/AgeableMob.java
+++ b/net/minecraft/world/entity/AgeableMob.java
2025-04-12 17:26:44 +02:00
@@ -129,6 +129,23 @@ public abstract class AgeableMob extends PathfinderMob {
2024-12-16 14:08:25 +01:00
super.onSyncedDataUpdated(key);
}
+ // Paper start - EAR 2
+ @Override
+ public void inactiveTick() {
+ super.inactiveTick();
+ if (this.level().isClientSide || this.ageLocked) { // CraftBukkit
+ this.refreshDimensions();
+ } else {
+ int age = this.getAge();
+ if (age < 0) {
+ this.setAge(++age);
+ } else if (age > 0) {
+ this.setAge(--age);
+ }
+ }
+ }
+ // Paper end - EAR 2
+
@Override
public void aiStep() {
super.aiStep();
diff --git a/net/minecraft/world/entity/AreaEffectCloud.java b/net/minecraft/world/entity/AreaEffectCloud.java
2025-04-12 17:26:44 +02:00
index bf44f6b9c8710e0c9a85d44f6217501abc98a7b1..bfd904e468bbf2cc1a5b3353d3a69ad5087c81ae 100644
2024-12-16 14:08:25 +01:00
--- a/net/minecraft/world/entity/AreaEffectCloud.java
+++ b/net/minecraft/world/entity/AreaEffectCloud.java
2025-04-12 17:26:44 +02:00
@@ -144,6 +144,16 @@ public class AreaEffectCloud extends Entity implements TraceableEntity {
2024-12-16 14:08:25 +01:00
this.duration = duration;
}
+ // Paper start - EAR 2
+ @Override
+ public void inactiveTick() {
+ super.inactiveTick();
+ if (this.tickCount >= this.waitTime + this.duration) {
+ this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
+ }
+ }
+ // Paper end - EAR 2
+
@Override
public void tick() {
super.tick();
2024-12-16 13:03:53 +01:00
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
2025-04-12 17:26:44 +02:00
index fd0cc1bf9e4425a0924ed77854907deec1a7348e..1c9e5f61d182cf60caa885135abddc879d602c48 100644
2024-12-16 13:03:53 +01:00
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
2025-04-12 17:26:44 +02:00
@@ -388,6 +388,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
2024-12-16 14:08:25 +01:00
private final int despawnTime; // Paper - entity despawn time limit
2025-02-16 11:46:37 -08:00
public int totalEntityAge; // Paper - age-like counter for all entities
2024-12-16 14:08:25 +01:00
public final io.papermc.paper.entity.activation.ActivationType activationType = io.papermc.paper.entity.activation.ActivationType.activationTypeFor(this); // Paper - EAR 2/tracking ranges
+ // Paper start - EAR 2
+ public final boolean defaultActivationState;
+ public long activatedTick = Integer.MIN_VALUE;
+ public boolean isTemporarilyActive;
+ public long activatedImmunityTick = Integer.MIN_VALUE;
+
+ public void inactiveTick() {
+ }
+ // Paper end - EAR 2
2025-04-12 17:26:44 +02:00
// CraftBukkit end
2024-12-16 14:08:25 +01:00
2025-04-12 17:26:44 +02:00
// Paper start
@@ -403,6 +412,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
2024-12-16 14:08:25 +01:00
this.position = Vec3.ZERO;
this.blockPosition = BlockPos.ZERO;
this.chunkPosition = ChunkPos.ZERO;
+ // Paper start - EAR 2
+ if (level != null) {
+ this.defaultActivationState = io.papermc.paper.entity.activation.ActivationRange.initializeEntityActivationState(this, level.spigotConfig);
+ } else {
+ this.defaultActivationState = false;
+ }
+ // Paper end - EAR 2
SynchedEntityData.Builder builder = new SynchedEntityData.Builder(this);
builder.define(DATA_SHARED_FLAGS_ID, (byte)0);
builder.define(DATA_AIR_SUPPLY_ID, this.getMaxAirSupply());
2025-04-12 17:26:44 +02:00
@@ -958,6 +974,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z);
2021-06-11 14:02:28 +02:00
} else {
2024-10-24 19:40:24 +01:00
if (type == MoverType.PISTON) {
2025-04-12 17:26:44 +02:00
+ // Paper start - EAR 2
+ this.activatedTick = Math.max(this.activatedTick, MinecraftServer.currentTick + 20);
+ this.activatedImmunityTick = Math.max(this.activatedImmunityTick, MinecraftServer.currentTick + 20);
+ // Paper end - EAR 2
2021-06-11 14:02:28 +02:00
movement = this.limitPistonMovement(movement);
if (movement.equals(Vec3.ZERO)) {
return;
2025-04-12 17:26:44 +02:00
@@ -971,6 +991,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
2021-06-11 14:02:28 +02:00
this.stuckSpeedMultiplier = Vec3.ZERO;
this.setDeltaMovement(Vec3.ZERO);
}
+ // Paper start - ignore movement changes while inactive.
2024-10-24 19:40:24 +01:00
+ if (isTemporarilyActive && !(this instanceof ItemEntity) && movement == getDeltaMovement() && type == MoverType.SELF) {
2021-06-11 14:02:28 +02:00
+ setDeltaMovement(Vec3.ZERO);
2024-12-16 14:08:25 +01:00
+ profilerFiller.pop();
2021-06-11 14:02:28 +02:00
+ return;
+ }
+ // Paper end
2024-10-24 19:40:24 +01:00
movement = this.maybeBackOffFromEdge(movement, type);
2024-12-16 13:03:53 +01:00
Vec3 vec3 = this.collide(movement);
2024-12-16 14:08:25 +01:00
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
2025-04-12 17:26:44 +02:00
index 4123354a660f85905c8c2db1c5377201c2b8267e..7ba7a00b8dee651ca7a3cab5b64b4ae11aa66da9 100644
2024-12-16 14:08:25 +01:00
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
2025-04-12 17:26:44 +02:00
@@ -3163,6 +3163,14 @@ public abstract class LivingEntity extends Entity implements Attackable {
2024-12-16 14:08:25 +01:00
return false;
}
+ // Paper start - EAR 2
+ @Override
+ public void inactiveTick() {
+ super.inactiveTick();
+ ++this.noActionTime; // Above all the floats
+ }
+ // Paper end - EAR 2
+
@Override
public void tick() {
super.tick();
2024-12-16 13:03:53 +01:00
diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java
2025-04-12 17:26:44 +02:00
index 8f5c377540f83911c8d245fb00569f08dbc6a690..73ba442b9d39bc021cd5eb6c1c0f98aed94a5a02 100644
2024-12-16 13:03:53 +01:00
--- a/net/minecraft/world/entity/Mob.java
+++ b/net/minecraft/world/entity/Mob.java
2025-04-12 17:26:44 +02:00
@@ -203,6 +203,19 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
2021-06-11 14:02:28 +02:00
return this.lookControl;
}
+ // Paper start
+ @Override
+ public void inactiveTick() {
+ super.inactiveTick();
+ if (this.goalSelector.inactiveTick()) {
+ this.goalSelector.tick();
+ }
+ if (this.targetSelector.inactiveTick()) {
+ this.targetSelector.tick();
+ }
+ }
+ // Paper end
+
public MoveControl getMoveControl() {
2024-12-16 13:03:53 +01:00
return this.getControlledVehicle() instanceof Mob mob ? mob.getMoveControl() : this.moveControl;
}
diff --git a/net/minecraft/world/entity/PathfinderMob.java b/net/minecraft/world/entity/PathfinderMob.java
index 0caf50ec50f056b83a20bbc6a2fe0144593aef39..af59a700755654eb68d6bf57d0712c4a2ac6c09b 100644
--- a/net/minecraft/world/entity/PathfinderMob.java
+++ b/net/minecraft/world/entity/PathfinderMob.java
@@ -17,6 +17,8 @@ public abstract class PathfinderMob extends Mob {
super(entityType, level);
2021-11-24 08:37:09 +01:00
}
2021-06-11 14:02:28 +02:00
2024-07-18 16:50:16 +02:00
+ public BlockPos movingTarget; public BlockPos getMovingTarget() { return movingTarget; } // Paper
+
2021-11-24 08:37:09 +01:00
public float getWalkTargetValue(BlockPos pos) {
2023-06-07 23:14:56 +02:00
return this.getWalkTargetValue(pos, this.level());
2024-07-18 16:50:16 +02:00
}
2024-12-16 13:03:53 +01:00
diff --git a/net/minecraft/world/entity/ai/goal/GoalSelector.java b/net/minecraft/world/entity/ai/goal/GoalSelector.java
2024-12-16 14:08:25 +01:00
index 9338e63cc28413f5559bb0122ef5e04a84bd51d1..eeba224bd575451ba6023df65ef9d9b97f7f1c71 100644
2024-12-16 13:03:53 +01:00
--- a/net/minecraft/world/entity/ai/goal/GoalSelector.java
+++ b/net/minecraft/world/entity/ai/goal/GoalSelector.java
2024-12-16 14:08:25 +01:00
@@ -25,6 +25,7 @@ public class GoalSelector {
2024-10-24 19:40:24 +01:00
private final Map<Goal.Flag, WrappedGoal> lockedFlags = new EnumMap<>(Goal.Flag.class);
2024-04-25 11:42:10 +02:00
private final Set<WrappedGoal> availableGoals = new ObjectLinkedOpenHashSet<>();
2024-12-16 14:08:25 +01:00
private final EnumSet<Goal.Flag> disabledFlags = EnumSet.noneOf(Goal.Flag.class);
+ private int curRate; // Paper - EAR 2
2021-06-11 14:02:28 +02:00
2024-10-24 19:40:24 +01:00
public void addGoal(int priority, Goal goal) {
this.availableGoals.add(new WrappedGoal(priority, goal));
2024-12-16 14:08:25 +01:00
@@ -35,6 +36,22 @@ public class GoalSelector {
2024-12-16 13:03:53 +01:00
this.availableGoals.removeIf(wrappedGoal -> filter.test(wrappedGoal.getGoal()));
2021-06-11 14:02:28 +02:00
}
2024-10-24 19:40:24 +01:00
+ // Paper start - EAR 2
2021-06-11 14:02:28 +02:00
+ public boolean inactiveTick() {
2021-06-13 12:29:58 -07:00
+ this.curRate++;
2024-04-25 11:42:10 +02:00
+ return this.curRate % 3 == 0; // TODO newGoalRate was already unused in 1.20.4, check if this is correct
2021-06-11 14:02:28 +02:00
+ }
2024-12-16 13:03:53 +01:00
+
2021-06-11 14:02:28 +02:00
+ public boolean hasTasks() {
2021-06-13 12:29:58 -07:00
+ for (WrappedGoal task : this.availableGoals) {
2021-06-11 14:02:28 +02:00
+ if (task.isRunning()) {
+ return true;
+ }
+ }
+ return false;
+ }
2024-10-24 19:40:24 +01:00
+ // Paper end - EAR 2
2024-12-16 13:03:53 +01:00
+
2021-06-11 14:02:28 +02:00
public void removeGoal(Goal goal) {
2024-04-25 11:42:10 +02:00
for (WrappedGoal wrappedGoal : this.availableGoals) {
if (wrappedGoal.getGoal() == goal && wrappedGoal.isRunning()) {
2024-12-16 13:03:53 +01:00
diff --git a/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java b/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
index 789fea258d70e60d38271ebb31270562dc7eb3ab..d0ab3db7bbd2942db19f473474371b20ce822608 100644
--- a/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
+++ b/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
@@ -23,6 +23,14 @@ public abstract class MoveToBlockGoal extends Goal {
public MoveToBlockGoal(PathfinderMob mob, double speedModifier, int searchRange) {
this(mob, speedModifier, searchRange, 1);
2021-06-11 14:02:28 +02:00
}
+ // Paper start - activation range improvements
+ @Override
2021-06-13 12:29:58 -07:00
+ public void stop() {
+ super.stop();
2024-01-21 13:56:22 +01:00
+ this.blockPos = BlockPos.ZERO;
+ this.mob.movingTarget = null;
2021-06-11 14:02:28 +02:00
+ }
+ // Paper end
2024-12-16 13:03:53 +01:00
public MoveToBlockGoal(PathfinderMob mob, double speedModifier, int searchRange, int verticalSearchRange) {
2021-06-13 12:29:58 -07:00
this.mob = mob;
2024-12-16 13:03:53 +01:00
@@ -113,6 +121,7 @@ public abstract class MoveToBlockGoal extends Goal {
mutableBlockPos.setWithOffset(blockPos, i4, i2 - 1, i5);
2023-06-07 23:14:56 +02:00
if (this.mob.isWithinRestriction(mutableBlockPos) && this.isValidTarget(this.mob.level(), mutableBlockPos)) {
2021-06-13 12:29:58 -07:00
this.blockPos = mutableBlockPos;
2024-01-21 13:56:22 +01:00
+ this.mob.movingTarget = mutableBlockPos == BlockPos.ZERO ? null : mutableBlockPos.immutable(); // Paper
2021-06-11 14:02:28 +02:00
return true;
}
}
2024-12-16 14:08:25 +01:00
diff --git a/net/minecraft/world/entity/item/ItemEntity.java b/net/minecraft/world/entity/item/ItemEntity.java
2025-04-12 17:26:44 +02:00
index ea3afc27600cde05a17197b071f14972d2c832e6..6c0ebfb2be4e8b884456a2aa3d5fdc87e45a0e3c 100644
2024-12-16 14:08:25 +01:00
--- a/net/minecraft/world/entity/item/ItemEntity.java
+++ b/net/minecraft/world/entity/item/ItemEntity.java
2025-04-12 17:26:44 +02:00
@@ -131,6 +131,29 @@ public class ItemEntity extends Entity implements TraceableEntity {
2024-12-16 14:08:25 +01:00
return 0.04;
}
+ // Paper start - EAR 2
+ @Override
+ public void inactiveTick() {
+ super.inactiveTick();
+ if (this.pickupDelay > 0 && this.pickupDelay != 32767) {
+ this.pickupDelay--;
+ }
+ if (this.age != -32768) {
+ this.age++;
+ }
+
+ if (!this.level().isClientSide && this.age >= this.despawnRate) {// Paper - Alternative item-despawn-rate
+ // CraftBukkit start - fire ItemDespawnEvent
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
+ this.age = 0;
+ return;
+ }
+ // CraftBukkit end
+ this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
+ }
+ }
+ // Paper end - EAR 2
+
@Override
public void tick() {
if (this.getItem().isEmpty()) {
2024-12-16 13:03:53 +01:00
diff --git a/net/minecraft/world/entity/npc/Villager.java b/net/minecraft/world/entity/npc/Villager.java
2025-04-12 17:26:44 +02:00
index 94032c60944f161519f0ddee69426cbfe3075170..e0e0d2ea7fc60e3142c675404d152eca60263240 100644
2024-12-16 13:03:53 +01:00
--- a/net/minecraft/world/entity/npc/Villager.java
+++ b/net/minecraft/world/entity/npc/Villager.java
2025-04-12 17:26:44 +02:00
@@ -268,11 +268,35 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
2024-12-16 14:08:25 +01:00
return this.assignProfessionWhenSpawned;
}
+ // Paper start - EAR 2
+ @Override
+ public void inactiveTick() {
+ // SPIGOT-3874, SPIGOT-3894, SPIGOT-3846, SPIGOT-5286 :(
2021-06-13 12:29:58 -07:00
+ if (this.getUnhappyCounter() > 0) {
+ this.setUnhappyCounter(this.getUnhappyCounter() - 1);
2024-12-16 14:08:25 +01:00
+ }
2021-06-11 14:02:28 +02:00
+ if (this.isEffectiveAi()) {
2023-06-07 23:35:19 +02:00
+ if (this.level().spigotConfig.tickInactiveVillagers) {
2024-10-24 19:40:24 +01:00
+ this.customServerAiStep(this.level().getMinecraftWorld());
2021-06-11 14:02:28 +02:00
+ } else {
2024-10-24 19:40:24 +01:00
+ this.customServerAiStep(this.level().getMinecraftWorld(), true);
2021-06-11 14:02:28 +02:00
+ }
2024-12-16 13:03:53 +01:00
+ }
2025-04-12 17:26:44 +02:00
+ this.maybeDecayGossip();
2024-12-16 14:08:25 +01:00
+ super.inactiveTick();
+ }
+ // Paper end - EAR 2
+
2021-06-11 14:02:28 +02:00
@Override
2024-12-16 13:03:53 +01:00
protected void customServerAiStep(ServerLevel level) {
2024-10-24 19:40:24 +01:00
+ // Paper start - EAR 2
2024-12-16 13:03:53 +01:00
+ this.customServerAiStep(level, false);
2023-06-07 23:14:56 +02:00
+ }
2024-12-16 13:03:53 +01:00
+ protected void customServerAiStep(ServerLevel level, final boolean inactive) {
2024-10-24 19:40:24 +01:00
+ // Paper end - EAR 2
2024-12-16 13:03:53 +01:00
ProfilerFiller profilerFiller = Profiler.get();
profilerFiller.push("villagerBrain");
- this.getBrain().tick(level, this);
+ if (!inactive) this.getBrain().tick(level, this); // Paper - EAR 2
profilerFiller.pop();
2021-06-11 14:02:28 +02:00
if (this.assignProfessionWhenSpawned) {
this.assignProfessionWhenSpawned = false;
2025-04-12 17:26:44 +02:00
@@ -296,7 +320,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
2021-06-11 14:02:28 +02:00
this.lastTradedPlayer = null;
}
- if (!this.isNoAi() && this.random.nextInt(100) == 0) {
2024-10-24 19:40:24 +01:00
+ if (!inactive && !this.isNoAi() && this.random.nextInt(100) == 0) { // Paper - EAR 2
2024-12-16 13:03:53 +01:00
Raid raidAt = level.getRaidAt(this.blockPosition());
if (raidAt != null && raidAt.isActive() && !raidAt.isOver()) {
level.broadcastEntityEvent(this, (byte)42);
2025-04-12 17:26:44 +02:00
@@ -307,6 +331,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
2021-06-11 14:02:28 +02:00
this.stopTrading();
}
2025-04-12 17:26:44 +02:00
+ if (inactive) return; // Paper - EAR 2
2024-12-16 13:03:53 +01:00
super.customServerAiStep(level);
2021-06-11 14:02:28 +02:00
}
2025-04-12 17:26:44 +02:00
2024-12-16 14:08:25 +01:00
diff --git a/net/minecraft/world/entity/projectile/Arrow.java b/net/minecraft/world/entity/projectile/Arrow.java
2025-04-12 17:26:44 +02:00
index 1f22f44abb21d1ed9a4870f668779efb8fd9b295..91ead824718eeea2afba3bc0ef619b8a24bb24b9 100644
2024-12-16 14:08:25 +01:00
--- a/net/minecraft/world/entity/projectile/Arrow.java
+++ b/net/minecraft/world/entity/projectile/Arrow.java
2025-04-12 17:26:44 +02:00
@@ -70,6 +70,16 @@ public class Arrow extends AbstractArrow {
2024-12-16 14:08:25 +01:00
builder.define(ID_EFFECT_COLOR, -1);
}
+ // Paper start - EAR 2
+ @Override
+ public void inactiveTick() {
+ if (this.isInGround()) {
+ this.life++;
+ }
+ super.inactiveTick();
+ }
+ // Paper end
+
@Override
public void tick() {
super.tick();
diff --git a/net/minecraft/world/entity/projectile/FireworkRocketEntity.java b/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
2025-04-12 17:26:44 +02:00
index dcb7714b2edeab8cfb0358929d07bd04cead26bf..e0e193078e550225e163149638bf9e053c0531f8 100644
2024-12-16 14:08:25 +01:00
--- a/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
+++ b/net/minecraft/world/entity/projectile/FireworkRocketEntity.java
2025-04-12 17:26:44 +02:00
@@ -109,6 +109,21 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier {
2024-12-16 14:08:25 +01:00
return super.shouldRender(x, y, z) && !this.isAttachedToEntity();
}
+ // Paper start - EAR 2
+ @Override
+ public void inactiveTick() {
+ this.life++;
+ if (this.life > this.lifetime && this.level() instanceof ServerLevel serverLevel) {
2025-03-23 20:20:14 -03:00
+ // Paper start - Call FireworkExplodeEvent
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callFireworkExplodeEvent(this)) {
2024-12-16 14:08:25 +01:00
+ this.explode(serverLevel);
+ }
2025-03-23 20:20:14 -03:00
+ // Paper end - Call FireworkExplodeEvent
2024-12-16 14:08:25 +01:00
+ }
+ super.inactiveTick();
+ }
+ // Paper end - EAR 2
+
@Override
public void tick() {
super.tick();
2024-12-16 13:03:53 +01:00
diff --git a/net/minecraft/world/entity/vehicle/MinecartHopper.java b/net/minecraft/world/entity/vehicle/MinecartHopper.java
2025-04-12 17:26:44 +02:00
index 6162415095b030b4cc47364c56fa66236b3b0535..a56d9cdeb6589a053ffaaf2cd599a98ae0a0989a 100644
2024-12-16 13:03:53 +01:00
--- a/net/minecraft/world/entity/vehicle/MinecartHopper.java
+++ b/net/minecraft/world/entity/vehicle/MinecartHopper.java
2025-04-12 17:26:44 +02:00
@@ -48,6 +48,7 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper
2024-12-16 13:03:53 +01:00
if (flag != this.isEnabled()) {
this.setEnabled(flag);
2022-08-14 19:41:15 +02:00
}
2024-12-18 23:35:47 +01:00
+ this.immunize(); // Paper
2022-08-14 19:41:15 +02:00
}
2024-04-12 12:14:06 -07:00
public boolean isEnabled() {
2025-04-12 17:26:44 +02:00
@@ -101,11 +102,13 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper
2022-08-14 19:41:15 +02:00
public boolean suckInItems() {
2023-06-07 23:14:56 +02:00
if (HopperBlockEntity.suckInItems(this.level(), this)) {
2024-12-18 23:35:47 +01:00
+ this.immunize(); // Paper
2022-08-14 19:41:15 +02:00
return true;
} else {
2024-04-12 12:14:06 -07:00
for (ItemEntity itemEntity : this.level()
.getEntitiesOfClass(ItemEntity.class, this.getBoundingBox().inflate(0.25, 0.0, 0.25), EntitySelector.ENTITY_STILL_ALIVE)) {
2023-03-14 20:54:57 +01:00
if (HopperBlockEntity.addItem(this, itemEntity)) {
2024-12-18 23:35:47 +01:00
+ this.immunize(); // Paper
2023-03-14 20:54:57 +01:00
return true;
}
2022-08-14 19:41:15 +02:00
}
2025-04-12 17:26:44 +02:00
@@ -140,4 +143,11 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper
2024-12-16 13:03:53 +01:00
public AbstractContainerMenu createMenu(int id, Inventory playerInventory) {
return new HopperMenu(id, playerInventory, this);
2022-08-14 19:41:15 +02:00
}
+
+ // Paper start
+ public void immunize() {
+ this.activatedImmunityTick = Math.max(this.activatedImmunityTick, net.minecraft.server.MinecraftServer.currentTick + 20);
+ }
+ // Paper end
+
}
2024-12-16 13:03:53 +01:00
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
2025-04-12 17:26:44 +02:00
index 1aa98e4f70627632d3e676395c28fa0ecca72f56..1f26826b2161cfeb27e5b2060e178b493e9142d9 100644
2024-12-16 13:03:53 +01:00
--- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java
2025-04-12 17:26:44 +02:00
@@ -143,6 +143,12 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
@Nullable
2024-12-16 13:03:53 +01:00
public List<net.minecraft.world.entity.item.ItemEntity> captureDrops;
2022-02-12 14:20:33 +01:00
public final it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<SpawnCategory> ticksPerSpawnCategory = new it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<>();
2025-04-12 17:26:44 +02:00
+ // Paper start - EAR 2
2021-06-11 14:02:28 +02:00
+ public int wakeupInactiveRemainingAnimals;
+ public int wakeupInactiveRemainingFlying;
+ public int wakeupInactiveRemainingMonsters;
+ public int wakeupInactiveRemainingVillagers;
2025-04-12 17:26:44 +02:00
+ // Paper end - EAR 2
2021-06-11 14:02:28 +02:00
public boolean populating;
public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
2024-01-13 12:31:02 -08:00
// Paper start - add paper world config
2024-12-16 13:03:53 +01:00
diff --git a/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
2025-04-12 17:26:44 +02:00
index f8d10be7a0aa7f66f05126e75187025c040e3494..1669b76800756000a2f620610b3c8c8b6c48dd4a 100644
2024-12-16 13:03:53 +01:00
--- a/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
+++ b/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
2025-04-12 17:26:44 +02:00
@@ -153,6 +153,10 @@ public class PistonMovingBlockEntity extends BlockEntity {
2021-08-21 16:15:29 +02:00
}
2024-12-16 13:03:53 +01:00
entity.setDeltaMovement(d1, d2, d3);
+ // Paper - EAR items stuck in slime pushed by a piston
2021-08-25 09:59:26 +02:00
+ entity.activatedTick = Math.max(entity.activatedTick, net.minecraft.server.MinecraftServer.currentTick + 10);
+ entity.activatedImmunityTick = Math.max(entity.activatedImmunityTick, net.minecraft.server.MinecraftServer.currentTick + 10);
2021-08-21 16:15:29 +02:00
+ // Paper end
break;
}
}