Paper/patches/server/0334-Entity-Activation-Range-2.0.patch

816 lines
43 KiB
Diff
Raw Normal View History

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
== AT ==
public net.minecraft.world.entity.Entity isInsidePortal
public net.minecraft.world.entity.LivingEntity jumping
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
2023-09-22 14:33:54 +02:00
index 0b928a1cf86de9c83fd50472226be48443ed65a6..9bcf1fee8df0186f7355bf37ba7c39553bdbf1d0 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
2021-06-13 21:29:58 +02:00
@@ -2,7 +2,6 @@ package net.minecraft.server.level;
import com.google.common.annotations.VisibleForTesting;
import co.aikar.timings.TimingHistory; // Paper
-import co.aikar.timings.Timings; // Paper
import com.google.common.collect.Lists;
import com.mojang.datafixers.DataFixer;
2022-03-01 06:43:03 +01:00
import com.mojang.datafixers.util.Pair;
2023-09-22 04:31:59 +02:00
@@ -956,17 +955,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
2021-06-13 21:29:58 +02:00
++TimingHistory.entityTicks; // Paper - timings
// Spigot start
co.aikar.timings.Timing timer; // Paper
- if (!org.spigotmc.ActivationRange.checkIfActive(entity)) {
+ /*if (!org.spigotmc.ActivationRange.checkIfActive(entity)) { // Paper - comment out - EAR 2, reimplement below
entity.tickCount++;
timer = entity.getType().inactiveTickTimer.startTiming(); try { // Paper - timings
entity.inactiveTick();
} finally { timer.stopTiming(); } // Paper
return;
- }
+ }*/ // Paper - comment out EAR 2
// Spigot end
// Paper start- timings
- TimingHistory.activatedEntityTicks++;
- timer = entity.getVehicle() != null ? entity.getType().passengerTickTimer.startTiming() : entity.getType().tickTimer.startTiming();
+ final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(entity);
+ timer = isActive ? entity.getType().tickTimer.startTiming() : entity.getType().inactiveTickTimer.startTiming(); // Paper
try {
// Paper end - timings
entity.setOldPosAndRot();
2023-09-22 04:31:59 +02:00
@@ -977,9 +976,13 @@ public class ServerLevel extends Level implements WorldGenLevel {
2022-12-07 20:22:28 +01:00
return BuiltInRegistries.ENTITY_TYPE.getKey(entity.getType()).toString();
2021-06-13 21:29:58 +02:00
});
gameprofilerfiller.incrementCounter("tickNonPassenger");
+ if (isActive) { // Paper - EAR 2
+ TimingHistory.activatedEntityTicks++;
entity.tick();
entity.postTick(); // CraftBukkit
+ } else { entity.inactiveTick(); } // Paper - EAR 2
this.getProfiler().pop();
+ } finally { timer.stopTiming(); } // Paper - timings
Iterator iterator = entity.getPassengers().iterator();
while (iterator.hasNext()) {
2023-09-22 04:31:59 +02:00
@@ -987,13 +990,18 @@ public class ServerLevel extends Level implements WorldGenLevel {
2021-06-13 21:29:58 +02:00
this.tickPassenger(entity, entity1);
}
- } finally { timer.stopTiming(); } // Paper - timings
+ // } finally { timer.stopTiming(); } // Paper - timings - move up
2021-06-11 14:02:28 +02:00
}
2021-06-13 21:29:58 +02:00
private void tickPassenger(Entity vehicle, Entity passenger) {
if (!passenger.isRemoved() && passenger.getVehicle() == vehicle) {
if (passenger instanceof Player || this.entityTickList.contains(passenger)) {
2021-06-11 14:02:28 +02:00
+ // Paper - EAR 2
+ final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(passenger);
+ co.aikar.timings.Timing timer = isActive ? passenger.getType().passengerTickTimer.startTiming() : passenger.getType().passengerInactiveTickTimer.startTiming(); // Paper
+ try {
+ // Paper end
2021-06-13 21:29:58 +02:00
passenger.setOldPosAndRot();
++passenger.tickCount;
ProfilerFiller gameprofilerfiller = this.getProfiler();
2023-09-22 04:31:59 +02:00
@@ -1002,8 +1010,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
2022-12-07 20:22:28 +01:00
return BuiltInRegistries.ENTITY_TYPE.getKey(passenger.getType()).toString();
2021-06-13 21:29:58 +02:00
});
gameprofilerfiller.incrementCounter("tickPassenger");
+ // Paper start - EAR 2
+ if (isActive) {
passenger.rideTick();
passenger.postTick(); // CraftBukkit
+ } else {
+ passenger.setDeltaMovement(Vec3.ZERO);
+ passenger.inactiveTick();
+ // copied from inside of if (isPassenger()) of passengerTick, but that ifPassenger is unnecessary
+ vehicle.positionRider(passenger);
+ }
+ // Paper end - EAR 2
gameprofilerfiller.pop();
Iterator iterator = passenger.getPassengers().iterator();
2021-06-11 14:02:28 +02:00
2023-09-22 04:31:59 +02:00
@@ -1013,6 +1030,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
2021-06-13 21:29:58 +02:00
this.tickPassenger(passenger, entity2);
}
2021-06-11 14:02:28 +02:00
2021-06-13 21:29:58 +02:00
+ } finally { timer.stopTiming(); }// Paper - EAR2 timings
2021-06-11 14:02:28 +02:00
}
} else {
2021-06-13 21:29:58 +02:00
passenger.stopRiding();
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
2023-09-22 04:31:59 +02:00
index 7c23f63fd642002cac597da2eafc5f0b4232d5a4..359f680c52dc44139e48673675617d97c1aa24a1 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -390,6 +390,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
public void inactiveTick() { }
// Spigot end
// Paper start
+ public long activatedImmunityTick = Integer.MIN_VALUE; // Paper
2021-06-11 14:02:28 +02:00
+ public boolean isTemporarilyActive = false; // Paper
protected int numCollisions = 0; // Paper
public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one
@javax.annotation.Nullable
2023-09-22 04:31:59 +02:00
@@ -910,6 +912,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
2021-06-11 14:02:28 +02:00
} else {
2021-06-13 21:29:58 +02:00
this.wasOnFire = this.isOnFire();
if (movementType == MoverType.PISTON) {
+ this.activatedTick = Math.max(this.activatedTick, MinecraftServer.currentTick + 20); // Paper
+ this.activatedImmunityTick = Math.max(this.activatedImmunityTick, MinecraftServer.currentTick + 20); // Paper
2021-06-11 14:02:28 +02:00
movement = this.limitPistonMovement(movement);
if (movement.equals(Vec3.ZERO)) {
return;
2023-09-22 04:31:59 +02:00
@@ -922,6 +926,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
2021-06-11 14:02:28 +02:00
this.stuckSpeedMultiplier = Vec3.ZERO;
this.setDeltaMovement(Vec3.ZERO);
}
+ // Paper start - ignore movement changes while inactive.
2021-06-13 21:29:58 +02:00
+ if (isTemporarilyActive && !(this instanceof ItemEntity || this instanceof net.minecraft.world.entity.vehicle.AbstractMinecart) && movement == getDeltaMovement() && movementType == MoverType.SELF) {
2021-06-11 14:02:28 +02:00
+ setDeltaMovement(Vec3.ZERO);
+ this.level.getProfiler().pop();
+ return;
+ }
+ // Paper end
2021-06-13 21:29:58 +02:00
movement = this.maybeBackOffFromEdge(movement, movementType);
2021-06-11 14:02:28 +02:00
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
2023-09-22 04:31:59 +02:00
index df0cc02f9bbea857226765c6066a2b945036a0d9..7bbb68bf06e04b58b6c4fa546fe919e387e00b27 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
2023-09-22 04:31:59 +02:00
@@ -220,6 +220,19 @@ public abstract class Mob extends LivingEntity implements Targeting {
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() {
2023-03-14 20:54:57 +01:00
Entity entity = this.getControlledVehicle();
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
2023-09-22 04:31:59 +02:00
index 5e9cf929674888b3a143a0691dc6936b304467f1..b5964614823059261c28eb2e998ad54249f07e7b 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java
+++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java
2023-09-22 04:31:59 +02:00
@@ -21,6 +21,7 @@ public abstract class PathfinderMob extends Mob {
2021-11-24 08:37:09 +01:00
}
2021-06-11 14:02:28 +02:00
public org.bukkit.craftbukkit.entity.CraftCreature getBukkitCreature() { return (org.bukkit.craftbukkit.entity.CraftCreature) super.getBukkitEntity(); } // Paper
+ public BlockPos movingTarget = null; public BlockPos getMovingTarget() { return movingTarget; } // Paper
2021-11-24 08:37:09 +01:00
public float getWalkTargetValue(BlockPos pos) {
return this.getWalkTargetValue(pos, this.level());
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
2022-12-07 20:22:28 +01:00
index 07c1ca01c38d5d7d0a95ad5004b5df9f4a222935..e5995d0db5dcfba59a873ff439601894fdacd556 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java
2022-12-07 20:22:28 +01:00
@@ -33,6 +33,7 @@ public class GoalSelector {
2021-06-11 14:02:28 +02:00
private final EnumSet<Goal.Flag> disabledFlags = EnumSet.noneOf(Goal.Flag.class);
2021-06-13 21:29:58 +02:00
private int tickCount;
private int newGoalRate = 3;
+ private int curRate;
2021-06-11 14:02:28 +02:00
public GoalSelector(Supplier<ProfilerFiller> profiler) {
this.profiler = profiler;
2022-12-07 20:22:28 +01:00
@@ -49,6 +50,20 @@ public class GoalSelector {
});
2021-06-11 14:02:28 +02:00
}
+ // Paper start
+ public boolean inactiveTick() {
2021-06-13 21:29:58 +02:00
+ this.curRate++;
+ return this.curRate % this.newGoalRate == 0;
2021-06-11 14:02:28 +02:00
+ }
+ public boolean hasTasks() {
2021-06-13 21:29:58 +02:00
+ for (WrappedGoal task : this.availableGoals) {
2021-06-11 14:02:28 +02:00
+ if (task.isRunning()) {
+ return true;
+ }
+ }
+ return false;
+ }
+ // Paper end
public void removeGoal(Goal goal) {
2021-06-13 21:29:58 +02:00
this.availableGoals.stream().filter((wrappedGoal) -> {
return wrappedGoal.getGoal() == goal;
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
index d27e5f9dac4703b839ab8444f6b54bf54d58af86..34f319ad09276c6f68dde449c79351de0d7d86f5 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
2021-06-13 21:29:58 +02:00
@@ -14,7 +14,7 @@ public abstract class MoveToBlockGoal extends Goal {
2021-06-11 14:02:28 +02:00
protected int nextStartTick;
protected int tryTicks;
private int maxStayTicks;
2021-06-17 21:52:26 +02:00
- protected BlockPos blockPos = BlockPos.ZERO; @Deprecated public final BlockPos getTargetPosition() { return this.blockPos; } // Paper - OBFHELPER
+ protected BlockPos blockPos = BlockPos.ZERO; @Deprecated public final BlockPos getTargetPosition() { return this.blockPos; } @Deprecated public void setTargetPosition(BlockPos pos) { this.blockPos = pos; mob.movingTarget = pos != BlockPos.ZERO ? pos : null; } // Paper - OBFHELPER
2021-06-11 14:02:28 +02:00
private boolean reachedTarget;
private final int searchRange;
private final int verticalSearchRange;
@@ -23,6 +23,13 @@ public abstract class MoveToBlockGoal extends Goal {
public MoveToBlockGoal(PathfinderMob mob, double speed, int range) {
this(mob, speed, range, 1);
}
+ // Paper start - activation range improvements
+ @Override
2021-06-13 21:29:58 +02:00
+ public void stop() {
+ super.stop();
2021-06-11 14:02:28 +02:00
+ setTargetPosition(BlockPos.ZERO);
+ }
+ // Paper end
public MoveToBlockGoal(PathfinderMob mob, double speed, int range, int maxYDifference) {
2021-06-13 21:29:58 +02:00
this.mob = mob;
2021-11-24 08:37:09 +01:00
@@ -114,6 +121,7 @@ public abstract class MoveToBlockGoal extends Goal {
2021-06-13 21:29:58 +02:00
mutableBlockPos.setWithOffset(blockPos, m, k - 1, n);
if (this.mob.isWithinRestriction(mutableBlockPos) && this.isValidTarget(this.mob.level(), mutableBlockPos)) {
2021-06-13 21:29:58 +02:00
this.blockPos = mutableBlockPos;
+ setTargetPosition(mutableBlockPos.immutable()); // Paper
2021-06-11 14:02:28 +02:00
return true;
}
}
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
2023-09-22 04:31:59 +02:00
index 7d7390dc76f683178fc332ea3c2c945ba8e9b84b..cc829161404c0f98a403c5219d5c535de1d5c5ba 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
2023-09-22 04:31:59 +02:00
@@ -227,17 +227,34 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
2021-06-11 14:02:28 +02:00
@Override
public void inactiveTick() {
// SPIGOT-3874, SPIGOT-3894, SPIGOT-3846, SPIGOT-5286 :(
- if (this.level().spigotConfig.tickInactiveVillagers && this.isEffectiveAi()) {
2021-06-11 14:02:28 +02:00
- this.customServerAiStep();
+ // Paper start
2021-06-13 21:29:58 +02:00
+ if (this.getUnhappyCounter() > 0) {
+ this.setUnhappyCounter(this.getUnhappyCounter() - 1);
}
2021-06-11 14:02:28 +02:00
+ if (this.isEffectiveAi()) {
2023-06-07 23:35:19 +02:00
+ if (this.level().spigotConfig.tickInactiveVillagers) {
2021-06-11 14:02:28 +02:00
+ this.customServerAiStep();
+ } else {
2023-06-07 23:35:19 +02:00
+ this.customServerAiStep(true);
2021-06-11 14:02:28 +02:00
+ }
+ }
2021-06-13 21:29:58 +02:00
+ maybeDecayGossip();
2021-06-11 14:02:28 +02:00
+ // Paper end
+
super.inactiveTick();
}
// Spigot End
@Override
+ @Deprecated // Paper
protected void customServerAiStep() {
+ // Paper start
+ this.customServerAiStep(false);
+ }
+ protected void customServerAiStep(final boolean inactive) {
+ // Paper end
this.level().getProfiler().push("villagerBrain");
- this.getBrain().tick((ServerLevel) this.level(), this);
+ if (!inactive) this.getBrain().tick((ServerLevel) this.level(), this); // Paper
this.level().getProfiler().pop();
2021-06-11 14:02:28 +02:00
if (this.assignProfessionWhenSpawned) {
this.assignProfessionWhenSpawned = false;
2023-09-22 04:31:59 +02:00
@@ -261,7 +278,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) {
+ if (!inactive && !this.isNoAi() && this.random.nextInt(100) == 0) { // Paper
Raid raid = ((ServerLevel) this.level()).getRaidAt(this.blockPosition());
2021-06-11 14:02:28 +02:00
if (raid != null && raid.isActive() && !raid.isOver()) {
2023-09-22 04:31:59 +02:00
@@ -272,6 +289,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
2021-06-11 14:02:28 +02:00
if (this.getVillagerData().getProfession() == VillagerProfession.NONE && this.isTrading()) {
this.stopTrading();
}
+ if (inactive) return; // Paper
super.customServerAiStep();
}
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java b/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java
index b149e8bcac034bb3fc118a9adcb0de45e18ed5e9..fc35cfc9d045f3e5b6a50af1d0ba83b6e322091f 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/MinecartHopper.java
2023-03-14 20:54:57 +01:00
@@ -52,6 +52,7 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper
if (bl != this.isEnabled()) {
this.setEnabled(bl);
}
+ this.immunize(); // Paper
}
2023-03-14 20:54:57 +01:00
@@ -89,10 +90,12 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper
public boolean suckInItems() {
if (HopperBlockEntity.suckInItems(this.level(), this)) {
+ this.immunize(); // Paper
return true;
} else {
for(ItemEntity itemEntity : this.level().getEntitiesOfClass(ItemEntity.class, this.getBoundingBox().inflate(0.25D, 0.0D, 0.25D), EntitySelector.ENTITY_STILL_ALIVE)) {
2023-03-14 20:54:57 +01:00
if (HopperBlockEntity.addItem(this, itemEntity)) {
+ this.immunize(); // Paper
return true;
}
}
2023-03-14 20:54:57 +01:00
@@ -122,4 +125,11 @@ public class MinecartHopper extends AbstractMinecartContainer implements Hopper
public AbstractContainerMenu createMenu(int syncId, Inventory playerInventory) {
return new HopperMenu(syncId, playerInventory, this);
}
+
+ // Paper start
+ public void immunize() {
+ this.activatedImmunityTick = Math.max(this.activatedImmunityTick, net.minecraft.server.MinecraftServer.currentTick + 20);
+ }
+ // Paper end
+
}
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
2023-09-22 04:31:59 +02:00
index 4968e036350631b79a8c7e70fdc32db4bcff2ade..495ab82a3a9d47583eb7239730aa78dd51f16fc6 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -160,6 +160,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public Map<BlockPos, BlockEntity> capturedTileEntities = new HashMap<>();
public List<ItemEntity> captureDrops;
public final it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<SpawnCategory> ticksPerSpawnCategory = new it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap<>();
2021-06-11 14:02:28 +02:00
+ // Paper start
+ public int wakeupInactiveRemainingAnimals;
+ public int wakeupInactiveRemainingFlying;
+ public int wakeupInactiveRemainingMonsters;
+ public int wakeupInactiveRemainingVillagers;
+ // Paper end
public boolean populating;
public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot
// Paper start
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
index 45f55c79a9d105f732054d61c4cf83eb5db49762..17a6327ab7b26dfab38881bbc0689b0b25f8f025 100644
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
2022-12-07 20:22:28 +01:00
@@ -143,6 +143,10 @@ public class PistonMovingBlockEntity extends BlockEntity {
}
entity.setDeltaMovement(e, g, h);
+ // Paper - EAR items stuck in in slime pushed by a piston
+ entity.activatedTick = Math.max(entity.activatedTick, net.minecraft.server.MinecraftServer.currentTick + 10);
+ entity.activatedImmunityTick = Math.max(entity.activatedImmunityTick, net.minecraft.server.MinecraftServer.currentTick + 10);
+ // Paper end
break;
}
}
2021-06-11 14:02:28 +02:00
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
2023-09-22 04:31:59 +02:00
index 5d470b424d52ae402ec0e950263ad54cf6f7e3ef..b1e844b1c0dafb2dfc9904d2d4ad0e8fd5b6e572 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/org/spigotmc/ActivationRange.java
+++ b/src/main/java/org/spigotmc/ActivationRange.java
@@ -1,39 +1,52 @@
2021-06-11 14:02:28 +02:00
package org.spigotmc;
+import net.minecraft.core.BlockPos;
import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.level.ServerChunkCache;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.ExperienceOrb;
2021-06-11 14:02:28 +02:00
+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.PathfinderMob;
+import net.minecraft.world.entity.ai.Brain;
import net.minecraft.world.entity.ambient.AmbientCreature;
import net.minecraft.world.entity.animal.Animal;
+import net.minecraft.world.entity.animal.Bee;
import net.minecraft.world.entity.animal.Sheep;
+import net.minecraft.world.entity.animal.WaterAnimal;
+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.PrimedTnt;
import net.minecraft.world.entity.monster.Creeper;
-import net.minecraft.world.entity.monster.Monster;
-import net.minecraft.world.entity.monster.Slime;
+import net.minecraft.world.entity.monster.Enemy;
+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.raid.Raider;
+import co.aikar.timings.MinecraftTimings;
+import net.minecraft.world.entity.schedule.Activity;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.AABB;
-import co.aikar.timings.MinecraftTimings;
public class ActivationRange
{
public enum ActivationType
{
+ WATER, // Paper
+ FLYING_MONSTER, // Paper
+ VILLAGER, // Paper
MONSTER,
ANIMAL,
RAIDER,
@@ -41,6 +54,43 @@ public class ActivationRange
2021-06-11 14:02:28 +02:00
AABB boundingBox = new AABB( 0, 0, 0, 0, 0, 0 );
}
+ // Paper start
+
+ static Activity[] VILLAGER_PANIC_IMMUNITIES = {
+ Activity.HIDE,
+ Activity.PRE_RAID,
+ Activity.RAID,
+ Activity.PANIC
+ };
+
+ private static int checkInactiveWakeup(Entity entity) {
2023-06-07 23:35:19 +02:00
+ Level world = entity.level();
2021-06-11 14:02:28 +02:00
+ SpigotWorldConfig config = world.spigotConfig;
+ 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;
+ }
+ // Paper end
static AABB maxBB = new AABB( 0, 0, 0, 0, 0, 0 );
@@ -53,10 +103,13 @@ public class ActivationRange
2021-06-11 14:02:28 +02:00
*/
public static ActivationType initializeEntityActivationType(Entity entity)
{
+ if (entity instanceof WaterAnimal) { return ActivationType.WATER; } // Paper
+ else if (entity instanceof Villager) { return ActivationType.VILLAGER; } // Paper
+ else if (entity instanceof FlyingMob && entity instanceof Enemy) { return ActivationType.FLYING_MONSTER; } // Paper - doing & Monster incase Flying no longer includes monster in future
if ( entity instanceof Raider )
{
return ActivationType.RAIDER;
- } else if ( entity instanceof Monster || entity instanceof Slime )
+ } else if ( entity instanceof Enemy ) // Paper - correct monster check
{
return ActivationType.MONSTER;
} else if ( entity instanceof PathfinderMob || entity instanceof AmbientCreature )
@@ -77,10 +130,14 @@ public class ActivationRange
2021-06-11 14:02:28 +02:00
*/
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config)
{
- if ( ( 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 )
+ if ( ( 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 )
+ || ( entity.activationType == ActivationType.VILLAGER && config.villagerActivationRange <= 0 ) // Paper
+ || ( entity.activationType == ActivationType.WATER && config.waterActivationRange <= 0 ) // Paper
+ || ( entity.activationType == ActivationType.FLYING_MONSTER && config.flyingMonsterActivationRange <= 0 ) // Paper
+ || entity instanceof EyeOfEnder // Paper
|| entity instanceof Player
|| entity instanceof ThrowableProjectile
|| entity instanceof EnderDragon
@@ -113,10 +170,25 @@ public class ActivationRange
2021-06-11 14:02:28 +02:00
final int raiderActivationRange = world.spigotConfig.raiderActivationRange;
final int animalActivationRange = world.spigotConfig.animalActivationRange;
final int monsterActivationRange = world.spigotConfig.monsterActivationRange;
+ // Paper start
+ 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);
+ final ServerChunkCache chunkProvider = (ServerChunkCache) world.getChunkSource();
+ // Paper end
int maxRange = Math.max( monsterActivationRange, animalActivationRange );
maxRange = Math.max( maxRange, raiderActivationRange );
maxRange = Math.max( maxRange, miscActivationRange );
+ // Paper start
+ maxRange = Math.max( maxRange, flyingActivationRange );
+ maxRange = Math.max( maxRange, waterActivationRange );
+ maxRange = Math.max( maxRange, villagerActivationRange );
+ // Paper end
maxRange = Math.min( ( world.spigotConfig.simulationDistance << 4 ) - 8, maxRange );
2021-06-11 14:02:28 +02:00
for ( Player player : world.players() )
@@ -127,11 +199,17 @@ public class ActivationRange
continue;
}
- ActivationRange.maxBB = player.getBoundingBox().inflate( maxRange, 256, maxRange );
- ActivationType.MISC.boundingBox = player.getBoundingBox().inflate( miscActivationRange, 256, miscActivationRange );
- ActivationType.RAIDER.boundingBox = player.getBoundingBox().inflate( raiderActivationRange, 256, raiderActivationRange );
- ActivationType.ANIMAL.boundingBox = player.getBoundingBox().inflate( animalActivationRange, 256, animalActivationRange );
- ActivationType.MONSTER.boundingBox = player.getBoundingBox().inflate( monsterActivationRange, 256, monsterActivationRange );
2021-06-11 14:02:28 +02:00
+ // Paper start
+ 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 );
2021-06-11 14:02:28 +02:00
+ // Paper end
2023-09-22 04:31:59 +02:00
world.getEntities().get(maxBB, ActivationRange::activateEntity);
}
@@ -166,60 +244,118 @@ public class ActivationRange
2021-06-11 14:02:28 +02:00
* @param entity
* @return
*/
- public static boolean checkEntityImmunities(Entity entity)
+ public static int checkEntityImmunities(Entity entity) // Paper - return # of ticks to get immunity
{
+ // Paper start
2023-06-07 23:35:19 +02:00
+ SpigotWorldConfig config = entity.level().spigotConfig;
2021-06-11 14:02:28 +02:00
+ int inactiveWakeUpImmunity = checkInactiveWakeup(entity);
+ if (inactiveWakeUpImmunity > -1) {
+ return inactiveWakeUpImmunity;
2023-03-23 22:57:03 +01:00
+ }
+ if (entity.getRemainingFireTicks() > 0) {
2021-06-11 14:02:28 +02:00
+ return 2;
+ }
+ if (entity.activatedImmunityTick >= MinecraftServer.currentTick) {
+ return 1;
+ }
2021-06-11 14:02:28 +02:00
+ long inactiveFor = MinecraftServer.currentTick - entity.activatedTick;
+ // Paper end
2023-03-23 22:57:03 +01:00
// quick checks.
- if ( entity.wasTouchingWater || entity.getRemainingFireTicks() > 0 )
2021-06-13 21:29:58 +02:00
+ if ( (entity.activationType != ActivationType.WATER && entity.wasTouchingWater && entity.isPushedByFluid()) ) // Paper
2023-03-23 22:57:03 +01:00
{
- return true;
2021-06-11 14:02:28 +02:00
+ return 100; // Paper
+ }
+ // Paper start
2023-06-07 23:35:19 +02:00
+ if ( !entity.onGround() || entity.getDeltaMovement().horizontalDistanceSqr() > 9.999999747378752E-6D )
+ {
+ return 100;
2023-03-23 22:57:03 +01:00
}
+ // Paper end
2021-06-11 14:02:28 +02:00
if ( !( entity instanceof AbstractArrow ) )
{
- if ( !entity.onGround() || !entity.passengers.isEmpty() || entity.isPassenger() )
+ if ( (!entity.onGround() && !(entity instanceof FlyingMob)) ) // Paper - remove passengers logic
2021-06-11 14:02:28 +02:00
{
- return true;
+ return 10; // Paper
}
} else if ( !( (AbstractArrow) entity ).inGround )
{
- return true;
+ return 1; // Paper
}
// special cases.
if ( entity instanceof LivingEntity )
{
LivingEntity living = (LivingEntity) entity;
- if ( /*TODO: Missed mapping? living.attackTicks > 0 || */ living.hurtTime > 0 || living.activeEffects.size() > 0 )
+ if ( living.onClimbable() || living.jumping || living.hurtTime > 0 || living.activeEffects.size() > 0 ) // Paper
{
- return true;
+ return 1; // Paper
}
- if ( entity instanceof PathfinderMob && ( (PathfinderMob) entity ).getTarget() != null )
+ if ( entity instanceof Mob && ((Mob) entity ).getTarget() != null) // Paper
{
- return true;
+ return 20; // Paper
2023-09-22 04:31:59 +02:00
}
- if ( entity instanceof Villager && ( (Villager) entity ).canBreed() )
2021-06-11 14:02:28 +02:00
+ // Paper start
+ if (entity instanceof Bee) {
+ Bee bee = (Bee)entity;
+ 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 Villager ) {
+ Brain<Villager> behaviorController = ((Villager) entity).getBrain();
+
+ if (config.villagersActiveForPanic) {
+ for (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;
+ }
+ }
2023-09-22 04:31:59 +02:00
+ }
2021-06-11 14:02:28 +02:00
+ if ( entity instanceof Llama && ( (Llama) entity ).inCaravan() )
{
- return true;
+ return 1;
}
+ // Paper end
if ( entity instanceof Animal )
{
Animal animal = (Animal) entity;
if ( animal.isBaby() || animal.isInLove() )
{
- return true;
+ return 5; // Paper
}
if ( entity instanceof Sheep && ( (Sheep) entity ).isSheared() )
{
- return true;
+ return 1; // Paper
}
}
if (entity instanceof Creeper && ((Creeper) entity).isIgnited()) { // isExplosive
- return true;
+ return 20; // Paper
2023-03-23 22:57:03 +01:00
+ }
2021-06-11 14:02:28 +02:00
+ // Paper start
+ if (entity instanceof Mob && ((Mob) entity).targetSelector.hasTasks() ) {
+ return 0;
2023-09-22 04:31:59 +02:00
+ }
2021-06-11 14:02:28 +02:00
+ if (entity instanceof Pillager) {
+ Pillager pillager = (Pillager) entity;
+ // TODO:?
2023-09-22 04:31:59 +02:00
}
2021-06-11 14:02:28 +02:00
+ // Paper end
}
// SPIGOT-6644: Otherwise the target refresh tick will be missed
if (entity instanceof ExperienceOrb) {
- return true;
+ return 20; // Paper
}
2021-06-11 14:02:28 +02:00
- return false;
+ return -1; // Paper
}
/**
2023-09-22 04:31:59 +02:00
@@ -234,8 +370,19 @@ public class ActivationRange
2021-06-13 21:29:58 +02:00
if ( entity instanceof FireworkRocketEntity ) {
2021-06-11 14:02:28 +02:00
return true;
}
+ // Paper start - special case always immunities
+ // immunize brand new entities, dead entities, and portal scenarios
+ if (entity.defaultActivationState || entity.tickCount < 20*10 || !entity.isAlive() || entity.isInsidePortal || entity.portalCooldown > 0) {
+ return true;
+ }
+ // immunize leashed entities
+ if (entity instanceof Mob && ((Mob)entity).getLeashHolder() instanceof Player) {
2021-06-11 14:02:28 +02:00
+ return true;
+ }
+ // Paper end
- boolean isActive = entity.activatedTick >= MinecraftServer.currentTick || entity.defaultActivationState;
+ boolean isActive = entity.activatedTick >= MinecraftServer.currentTick;
+ entity.isTemporarilyActive = false; // Paper
// Should this entity tick?
if ( !isActive )
2023-09-22 04:31:59 +02:00
@@ -243,15 +390,19 @@ public class ActivationRange
2021-06-11 14:02:28 +02:00
if ( ( MinecraftServer.currentTick - entity.activatedTick - 1 ) % 20 == 0 )
{
// Check immunities every 20 ticks.
2021-06-13 21:29:58 +02:00
- if ( ActivationRange.checkEntityImmunities( entity ) )
2021-06-11 14:02:28 +02:00
- {
- // Triggered some sort of immunity, give 20 full ticks before we check again.
- entity.activatedTick = MinecraftServer.currentTick + 20;
+ // Paper start
+ int immunity = checkEntityImmunities(entity);
+ if (immunity >= 0) {
+ entity.activatedTick = MinecraftServer.currentTick + immunity;
+ } else {
+ entity.isTemporarilyActive = true;
}
+ // Paper end
isActive = true;
+
}
// Add a little performance juice to active entities. Skip 1/4 if not immune.
- } else if ( !entity.defaultActivationState && (entity.tickCount + entity.getId()) % 4 == 0 && !ActivationRange.checkEntityImmunities( entity ) ) // Paper - Ensure checking item movement is offset from Spigot's entity activation range check
+ } else if ( (entity.tickCount + entity.getId()) % 4 == 0 && ActivationRange.checkEntityImmunities( entity ) < 0 ) // Paper
2021-06-11 14:02:28 +02:00
{
isActive = false;
}
diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9188) * Updated Upstream (Bukkit/CraftBukkit/Spigot) Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 2fcba9b2 SPIGOT-7347: Add missing documentation and details to ShapedRecipe c278419d PR-854: Move getHighestBlockYAt methods from World to RegionAccessor 201399fb PR-853: Add API for directly setting Display transformation matrices ecfa559a PR-849: Add InventoryView#setTitle 653d7edb SPIGOT-519: Add TNTPrimeEvent 22fccc09 PR-846: Add method to get chunk load level a070a52c PR-844: Add methods to convert Vector to and from JOML vectors cc7111fe PR-276: Add accessors to Wither's invulnerability ticks 777d24e9 SPIGOT-7209: Accessors and events for player's exp cooldown ccb2d01b SPIGOT-6308: Deprecate the location name property of map items cd04a31b PR-780: Add PlayerSpawnChangeEvent 7d1f5b64 SPIGOT-6780: Improve documentation for World#spawnFallingBlock 5696668a SPIGOT-6885: Add test and easier to debug code for reference in yaml configuration comments 2e13cff7 PR-589: Expand the FishHook API 2c7d3da5 PR-279: Minor edits to various Javadocs CraftBukkit Changes: 01b2e1af4 SPIGOT-7346: Disallow players from executing commands after disconnecting 7fe5ee022 PR-1186: Move getHighestBlockYAt methods from World to RegionAccessor bcc85ef67 PR-1185: Add API for directly setting Display transformation matrices a7cfc778f PR-1176: Add InventoryView#setTitle 563d42226 SPIGOT-519: Add TNTPrimeEvent ccbc6abca Add test for Chunk.LoadLevel mirroring 2926e0513 PR-1171: Add method to get chunk load level 63cad7f84 PR-375: Add accessors to Wither's invulnerability ticks bfd8b1ac8 SPIGOT-7209: Accessors and events for player's exp cooldown f92a41c39 PR-1181: Consolidate Location conversion code 10f866759 SPIGOT-6308: Deprecate the location name property of map items 82f7b658a PR-1095: Add PlayerSpawnChangeEvent b421af7e4 PR-808: Expand the FishHook API 598ad7b3f Increase outdated build delay Spigot Changes: d1bd3bd2 Rebuild patches e4265cc8 SPIGOT-7297: Entity Tracking Range option for Display entities * Work around javac bug * Call PlayerSpawnChangeEvent * Updated Upstream (Bukkit/CraftBukkit/Spigot) Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 2fcba9b2 SPIGOT-7347: Add missing documentation and details to ShapedRecipe c278419d PR-854: Move getHighestBlockYAt methods from World to RegionAccessor 201399fb PR-853: Add API for directly setting Display transformation matrices CraftBukkit Changes: 01b2e1af4 SPIGOT-7346: Disallow players from executing commands after disconnecting 7fe5ee022 PR-1186: Move getHighestBlockYAt methods from World to RegionAccessor bcc85ef67 PR-1185: Add API for directly setting Display transformation matrices Spigot Changes: 7da74dae Rebuild patches
2023-05-12 13:10:08 +02:00
index e873a311e2918e1cb72f190e14d088a3ed540aa8..77698b0555c5930645659b4af061c3f428bf8f65 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/org/spigotmc/SpigotWorldConfig.java
+++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java
@@ -205,14 +205,60 @@ public class SpigotWorldConfig
2021-06-11 14:02:28 +02:00
public int monsterActivationRange = 32;
public int raiderActivationRange = 48;
public int miscActivationRange = 16;
+ // Paper start
+ public int flyingMonsterActivationRange = 32;
+ public int waterActivationRange = 16;
+ public int villagerActivationRange = 32;
+ public int wakeUpInactiveAnimals = 4;
+ public int wakeUpInactiveAnimalsEvery = 60*20;
+ public int wakeUpInactiveAnimalsFor = 5*20;
+ public int wakeUpInactiveMonsters = 8;
+ public int wakeUpInactiveMonstersEvery = 20*20;
+ public int wakeUpInactiveMonstersFor = 5*20;
+ public int wakeUpInactiveVillagers = 4;
+ public int wakeUpInactiveVillagersEvery = 30*20;
+ public int wakeUpInactiveVillagersFor = 5*20;
+ public int wakeUpInactiveFlying = 8;
+ public int wakeUpInactiveFlyingEvery = 10*20;
+ public int wakeUpInactiveFlyingFor = 5*20;
+ public int villagersWorkImmunityAfter = 5*20;
+ public int villagersWorkImmunityFor = 20;
+ public boolean villagersActiveForPanic = true;
+ // Paper end
public boolean tickInactiveVillagers = true;
public boolean ignoreSpectatorActivation = false;
2021-06-11 14:02:28 +02:00
private void activationRange()
{
2021-06-13 21:29:58 +02:00
+ boolean hasAnimalsConfig = config.getInt("entity-activation-range.animals", this.animalActivationRange) != this.animalActivationRange; // Paper
this.animalActivationRange = this.getInt( "entity-activation-range.animals", this.animalActivationRange );
this.monsterActivationRange = this.getInt( "entity-activation-range.monsters", this.monsterActivationRange );
this.raiderActivationRange = this.getInt( "entity-activation-range.raiders", this.raiderActivationRange );
this.miscActivationRange = this.getInt( "entity-activation-range.misc", this.miscActivationRange );
2021-06-11 14:02:28 +02:00
+ // Paper start
2021-06-13 21:29:58 +02:00
+ this.waterActivationRange = this.getInt( "entity-activation-range.water", this.waterActivationRange );
+ this.villagerActivationRange = this.getInt( "entity-activation-range.villagers", hasAnimalsConfig ? this.animalActivationRange : this.villagerActivationRange );
+ this.flyingMonsterActivationRange = this.getInt( "entity-activation-range.flying-monsters", this.flyingMonsterActivationRange );
2021-06-11 14:02:28 +02:00
+
2021-06-13 21:29:58 +02:00
+ this.wakeUpInactiveAnimals = this.getInt("entity-activation-range.wake-up-inactive.animals-max-per-tick", this.wakeUpInactiveAnimals);
+ this.wakeUpInactiveAnimalsEvery = this.getInt("entity-activation-range.wake-up-inactive.animals-every", this.wakeUpInactiveAnimalsEvery);
+ this.wakeUpInactiveAnimalsFor = this.getInt("entity-activation-range.wake-up-inactive.animals-for", this.wakeUpInactiveAnimalsFor);
2021-06-11 14:02:28 +02:00
+
2021-06-13 21:29:58 +02:00
+ this.wakeUpInactiveMonsters = this.getInt("entity-activation-range.wake-up-inactive.monsters-max-per-tick", this.wakeUpInactiveMonsters);
+ this.wakeUpInactiveMonstersEvery = this.getInt("entity-activation-range.wake-up-inactive.monsters-every", this.wakeUpInactiveMonstersEvery);
+ this.wakeUpInactiveMonstersFor = this.getInt("entity-activation-range.wake-up-inactive.monsters-for", this.wakeUpInactiveMonstersFor);
2021-06-11 14:02:28 +02:00
+
2021-06-13 21:29:58 +02:00
+ this.wakeUpInactiveVillagers = this.getInt("entity-activation-range.wake-up-inactive.villagers-max-per-tick", this.wakeUpInactiveVillagers);
+ this.wakeUpInactiveVillagersEvery = this.getInt("entity-activation-range.wake-up-inactive.villagers-every", this.wakeUpInactiveVillagersEvery);
+ this.wakeUpInactiveVillagersFor = this.getInt("entity-activation-range.wake-up-inactive.villagers-for", this.wakeUpInactiveVillagersFor);
2021-06-11 14:02:28 +02:00
+
2021-06-13 21:29:58 +02:00
+ this.wakeUpInactiveFlying = this.getInt("entity-activation-range.wake-up-inactive.flying-monsters-max-per-tick", this.wakeUpInactiveFlying);
+ this.wakeUpInactiveFlyingEvery = this.getInt("entity-activation-range.wake-up-inactive.flying-monsters-every", this.wakeUpInactiveFlyingEvery);
+ this.wakeUpInactiveFlyingFor = this.getInt("entity-activation-range.wake-up-inactive.flying-monsters-for", this.wakeUpInactiveFlyingFor);
2021-06-11 14:02:28 +02:00
+
2021-06-13 21:29:58 +02:00
+ this.villagersWorkImmunityAfter = this.getInt( "entity-activation-range.villagers-work-immunity-after", this.villagersWorkImmunityAfter );
+ this.villagersWorkImmunityFor = this.getInt( "entity-activation-range.villagers-work-immunity-for", this.villagersWorkImmunityFor );
+ this.villagersActiveForPanic = this.getBoolean( "entity-activation-range.villagers-active-for-panic", this.villagersActiveForPanic );
2021-06-11 14:02:28 +02:00
+ // Paper end
2021-06-13 21:29:58 +02:00
this.tickInactiveVillagers = this.getBoolean( "entity-activation-range.tick-inactive-villagers", this.tickInactiveVillagers );
this.ignoreSpectatorActivation = this.getBoolean( "entity-activation-range.ignore-spectators", this.ignoreSpectatorActivation );
this.log( "Entity Activation Range: An " + this.animalActivationRange + " / Mo " + this.monsterActivationRange + " / Ra " + this.raiderActivationRange + " / Mi " + this.miscActivationRange + " / Tiv " + this.tickInactiveVillagers + " / Isa " + this.ignoreSpectatorActivation );