mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
Configurable delay for mob AI targetting
Allows for interesting gameplay elements and other interesting tweaks
This commit is contained in:
parent
52f7f753f9
commit
f3243cbd02
1 changed files with 56 additions and 0 deletions
|
@ -0,0 +1,56 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Zach Brown <1254957+zachbr@users.noreply.github.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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
|
||||
@@ -0,0 +0,0 @@ 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");
|
||||
@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
|
||||
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
|
||||
@@ -0,0 +0,0 @@ public class PaperSpigotWorldConfig
|
||||
{
|
||||
tntHeightNerf = getDouble( "tnt-entity-height-nerf", 0 );
|
||||
}
|
||||
+
|
||||
+ public static int aiTickDelay;
|
||||
+ private void aiTickDelay()
|
||||
+ {
|
||||
+ aiTickDelay = getInt( "ai-tick-delay", 0 );
|
||||
+ }
|
||||
}
|
||||
--
|
Loading…
Reference in a new issue