mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-19 01:17:42 +01:00
Upstream has released updates that appears to apply and compile correctly Paper Changes: 7caed1a8 [CI-SKIP] Rebuild patches 777073a5 Check horse entity validity in container interactions (#2584) d69fe6c5 Fix zero-tick instant grow farms MC-113809 (#2559) c68dbb86 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#2576) 1e521994 Update Paperclip 30f9955e Fix race conditions in flush allowing for previously scheduled tasks to execute later than the flush call (#2548) 9e1620e3 Improve save logic (#2485) 72860501 [CI-SKIP] Fix duplicate patch number 87355875 Fix nether portal frame creation (#2546) 26acc9b7 Re-add flat bedrock config option
63 lines
3.3 KiB
Diff
63 lines
3.3 KiB
Diff
From f210356f0372425ad10c0d1d19a7ae5dc0a8695f 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 | 6 ++++++
|
|
src/main/java/net/pl3x/purpur/PurpurConfig.java | 7 +++++++
|
|
2 files changed, 13 insertions(+)
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
|
|
index 830d93a85..d1d62a900 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,10 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
|
|
@Override
|
|
protected void mobTick() {
|
|
this.world.getMethodProfiler().enter("brain");
|
|
+ // Purpur start
|
|
+ boolean tick = (world.getTime() + brainTickOffset) % net.pl3x.purpur.PurpurConfig.villagerBrainTicks == 0;
|
|
+ if (((WorldServer) world).getMinecraftServer().lagging ? tick : net.pl3x.purpur.PurpurConfig.useVillagerBrainTicksOnlyWhenLagging || tick)
|
|
+ // Purpur end
|
|
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 cdfd39374..ed2cdf509 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
|
@@ -230,6 +230,13 @@ public class PurpurConfig {
|
|
snowmanPumpkinPutBack = getBoolean("settings.mobs.snow_golem.pumpkin-can-be-added-back", snowmanPumpkinPutBack);
|
|
}
|
|
|
|
+ public static boolean useVillagerBrainTicksOnlyWhenLagging = true;
|
|
+ public static int villagerBrainTicks = 20;
|
|
+ private static void villagerSettings() {
|
|
+ useVillagerBrainTicksOnlyWhenLagging = getBoolean("settings.mobs.villager.use-brain-ticks-only-when-lagging", useVillagerBrainTicksOnlyWhenLagging);
|
|
+ villagerBrainTicks = getInt("settings.mobs.villager.brain-ticks", villagerBrainTicks);
|
|
+ }
|
|
+
|
|
public static float zombieHorseSpawnChance = 0F;
|
|
private static void zombieHorseSettings() {
|
|
zombieHorseSpawnChance = (float) getDouble("settings.mobs.zombie_horse.spawn-chance", zombieHorseSpawnChance);
|
|
--
|
|
2.23.0.rc1
|
|
|