mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Implement configurable villager brain ticks
This commit is contained in:
@@ -0,0 +1,57 @@
|
|||||||
|
From d96f2d09d32e6c330b0c7344ee530cc699b81441 Mon Sep 17 00:00:00 2001
|
||||||
|
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||||
|
Date: Tue, 23 Jul 2019 08:28:21 -0500
|
||||||
|
Subject: [PATCH] Implement configurable villager brain ticks
|
||||||
|
|
||||||
|
---
|
||||||
|
src/main/java/net/minecraft/server/EntityVillager.java | 3 +++
|
||||||
|
src/main/java/net/pl3x/purpur/PurpurConfig.java | 5 +++++
|
||||||
|
2 files changed, 8 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
|
||||||
|
index c3bbf49978..afba9c36c9 100644
|
||||||
|
--- a/src/main/java/net/minecraft/server/EntityVillager.java
|
||||||
|
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
|
||||||
|
@@ -53,6 +53,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
|
||||||
|
}, MemoryModuleType.MEETING_POINT, (entityvillager, villageplacetype) -> {
|
||||||
|
return villageplacetype == VillagePlaceType.r;
|
||||||
|
});
|
||||||
|
+ private final int brainTickOffset; // Purpur
|
||||||
|
|
||||||
|
public EntityVillager(EntityTypes<? extends EntityVillager> entitytypes, World world) {
|
||||||
|
this(entitytypes, world, VillagerType.PLAINS);
|
||||||
|
@@ -66,6 +67,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
|
||||||
|
this.setCanPickupLoot(true);
|
||||||
|
this.setVillagerData(this.getVillagerData().withType(villagertype).withProfession(VillagerProfession.NONE));
|
||||||
|
this.br = this.a(new Dynamic(DynamicOpsNBT.a, new NBTTagCompound()));
|
||||||
|
+ brainTickOffset = getRandom().nextInt(100); // Purpur
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@@ -145,6 +147,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
|
||||||
|
@Override
|
||||||
|
protected void mobTick() {
|
||||||
|
this.world.getMethodProfiler().enter("brain");
|
||||||
|
+ if ((world.getTime() + brainTickOffset) % net.pl3x.purpur.PurpurConfig.villagerBrainTicks == 0) // Purpur
|
||||||
|
this.getBehaviorController().a((WorldServer) this.world, this); // CraftBukkit - decompile error
|
||||||
|
this.world.getMethodProfiler().exit();
|
||||||
|
if (!this.dY() && this.bE > 0) {
|
||||||
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||||
|
index d8321e8ec3..4943f48efd 100644
|
||||||
|
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||||
|
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||||
|
@@ -207,6 +207,11 @@ public class PurpurConfig {
|
||||||
|
snowmanPumpkinPutBack = getBoolean("settings.mobs.snow_golem.pumpkin-can-be-added-back", snowmanPumpkinPutBack);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ public static int villagerBrainTicks = 20;
|
||||||
|
+ private static void villagerSettings() {
|
||||||
|
+ villagerBrainTicks = getInt("settings.mobs.brain-ticks", villagerBrainTicks);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
public static boolean largeEnderChests = true;
|
||||||
|
private static void largeEnderChests() {
|
||||||
|
largeEnderChests = getBoolean("settings.large-ender-chests", largeEnderChests);
|
||||||
|
--
|
||||||
|
2.20.1
|
||||||
|
|
||||||
Reference in New Issue
Block a user