papermc/Spigot-Server-Patches/0027-Configurable-AI-target-selector-delay.patch
Zach Brown 4aef5602d5 Update from upstream SpigotMC
Remove defensive copy in EAR SpigotMC/Spigot@f1ba1f6c07
Make "moved wrongly limit" configurable SpigotMC/Spigot@f7ab380e16
Fix null Tile Entity Worlds (we already had this) SpigotMC/Spigot@b271cdbfa0
Fix slow tab complete for some commands SpigotMC/Spigot@f3b7952c73
Only suggest ops to deop and remove whitelist add case entirely SpigotMC/Spigot@0e1fcfbe70
Allow tab complete for /whitelist add SpigotMC/Spigot@27f8aa22bd
2014-07-22 15:25:09 -05:00

58 lines
2.3 KiB
Diff

From 6ae22ba0f985aa7b9b5a05d5da742bd9764c109a Mon Sep 17 00:00:00 2001
From: Zach Brown <Zbob750@live.com>
Date: Mon, 14 Jul 2014 01:20:46 -0500
Subject: [PATCH] Configurable AI target selector delay
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
index d0f7033..83b0fe2 100644
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -395,6 +395,11 @@ public abstract class EntityInsentient extends EntityLiving {
}
}
+ // PaperSpigot start - Configurable AI delay
+ private int aiTickDelay = org.github.paperspigot.PaperSpigotWorldConfig.aiTickDelay;
+ private int lastRun = -1;
+ // PaperSpigot end
+
protected void bn() {
++this.aU;
this.world.methodProfiler.a("checkDespawn");
@@ -415,9 +420,14 @@ public abstract class EntityInsentient extends EntityLiving {
this.world.methodProfiler.a("sensing");
this.bq.a();
this.world.methodProfiler.b();
- this.world.methodProfiler.a("targetSelector");
- this.targetSelector.a();
- this.world.methodProfiler.b();
+ // PaperSpigot start - Configurable AI delay
+ if (aiTickDelay == 0 || lastRun == -1 || MinecraftServer.currentTick - lastRun >= aiTickDelay) {
+ this.world.methodProfiler.a("targetSelector");
+ this.targetSelector.a();
+ this.world.methodProfiler.b();
+ lastRun = MinecraftServer.currentTick;
+ }
+ // PaperSpigot stop
this.world.methodProfiler.a("goalSelector");
this.goalSelector.a();
this.world.methodProfiler.b();
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 0d388af..765023d 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -175,4 +175,10 @@ public class PaperSpigotWorldConfig
{
tntHeightNerf = getDouble( "tnt-entity-height-nerf", 0 );
}
+
+ public static int aiTickDelay;
+ private void aiTickDelay()
+ {
+ aiTickDelay = getInt( "ai-tick-delay", 0 );
+ }
}
--
1.9.1