diff options
Diffstat (limited to 'patches/server/0594-Rate-options-and-timings-for-sensors-and-behaviors.patch')
-rw-r--r-- | patches/server/0594-Rate-options-and-timings-for-sensors-and-behaviors.patch | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/patches/server/0594-Rate-options-and-timings-for-sensors-and-behaviors.patch b/patches/server/0594-Rate-options-and-timings-for-sensors-and-behaviors.patch index 2862657b68..2832058fe5 100644 --- a/patches/server/0594-Rate-options-and-timings-for-sensors-and-behaviors.patch +++ b/patches/server/0594-Rate-options-and-timings-for-sensors-and-behaviors.patch @@ -28,7 +28,7 @@ index 4bd813161a5d76a83cdbd0a9209b9ea9e60ffe1b..e2764186bd6b838ed5cd86c15597a08d * Get a named timer for the specified tile entity type to track type specific timings. * @param entity diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java -index db231b1353a1d5ca4fb217f5ebf8d7584706478d..0a2e894d8bd1268fcbd4460745304816be46beff 100644 +index f639cafa64d98a001e622882c647701547f5c3ac..03092417cd8ab5c6d266f3af9f20f47b34cfaba3 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/Behavior.java @@ -14,6 +14,10 @@ public abstract class Behavior<E extends LivingEntity> implements BehaviorContro @@ -71,7 +71,7 @@ index db231b1353a1d5ca4fb217f5ebf8d7584706478d..0a2e894d8bd1268fcbd4460745304816 if (this.hasRequiredMemories(entity) && this.checkExtraStartConditions(world, entity)) { this.status = Behavior.Status.RUNNING; int i = this.minDuration + world.getRandom().nextInt(this.maxDuration + 1 - this.minDuration); - this.endTimestamp = time + i; + this.endTimestamp = time + (long)i; + this.timing.startTiming(); // Paper - behavior timings this.start(world, entity, time); + this.timing.stopTiming(); // Paper - behavior timings @@ -93,7 +93,7 @@ index db231b1353a1d5ca4fb217f5ebf8d7584706478d..0a2e894d8bd1268fcbd4460745304816 protected void tick(ServerLevel world, E entity, long time) { diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java -index eebe5d721a6cea42013f5293586865deb39fe9d2..de2dfaf3cb41bafd48fa4699096a0a7304cd3201 100644 +index 671fc7725d7c801a2ba009da5bd1bc1a9530f187..9e90cb2f51d1bacacb287e912d14ab9152523205 100644 --- a/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java +++ b/src/main/java/net/minecraft/world/entity/ai/sensing/Sensor.java @@ -26,8 +26,21 @@ public abstract class Sensor<E extends LivingEntity> { @@ -116,13 +116,13 @@ index eebe5d721a6cea42013f5293586865deb39fe9d2..de2dfaf3cb41bafd48fa4699096a0a73 + this.timing = co.aikar.timings.MinecraftTimings.getSensorTimings(configKey, senseInterval); + // Paper end this.scanRate = senseInterval; - this.timeToTick = RANDOM.nextInt(senseInterval); + this.timeToTick = (long)RANDOM.nextInt(senseInterval); } @@ -38,8 +51,12 @@ public abstract class Sensor<E extends LivingEntity> { public final void tick(ServerLevel world, E entity) { if (--this.timeToTick <= 0L) { -- this.timeToTick = this.scanRate; +- this.timeToTick = (long)this.scanRate; + // Paper start - configurable sensor tick rate and timings + this.timeToTick = java.util.Objects.requireNonNullElse(world.paperConfig().tickRates.sensor.get(entity.getType(), this.configKey), this.scanRate); + this.timing.startTiming(); |