mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-20 18:07:43 +01:00
Updated Upstream (Paper)
Upstream has released updates that appears to apply and compile correctly Paper Changes: 821ce25d9 Significantly improve performance of the end generation 2b2e4fd65 Add Wandering Trader spawn rate config options 7263cbca7 [CI-SKIP] [Auto] Rebuild Patches 1c63aff6d Villager resetOffers API 8d8d74a5f Patch 2 references an invalid variable e6d7bdca1 [CI-SKIP] fixed sed -i for bsd sed (#4782) 7ae47d4eb [CI-SKIP] Remove Waving banner fix (#4786)
This commit is contained in:
55
patches/server/0022-Configurable-villager-brain-ticks.patch
Normal file
55
patches/server/0022-Configurable-villager-brain-ticks.patch
Normal file
@@ -0,0 +1,55 @@
|
||||
From 0000000000000000000000000000000000000000 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] Configurable villager brain ticks
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java
|
||||
index 3c20a4e1c..a02f54ab3 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityVillager.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityVillager.java
|
||||
@@ -58,6 +58,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
|
||||
}, MemoryModuleType.MEETING_POINT, (entityvillager, villageplacetype) -> {
|
||||
return villageplacetype == VillagePlaceType.s;
|
||||
});
|
||||
+ private final int brainTickOffset; // Purpur
|
||||
|
||||
public EntityVillager(EntityTypes<? extends EntityVillager> entitytypes, World world) {
|
||||
this(entitytypes, world, VillagerType.PLAINS);
|
||||
@@ -70,6 +71,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
|
||||
this.getNavigation().d(true);
|
||||
this.setCanPickupLoot(true);
|
||||
this.setVillagerData(this.getVillagerData().withType(villagertype).withProfession(VillagerProfession.NONE));
|
||||
+ this.brainTickOffset = getRandom().nextInt(100); // Purpur
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -166,7 +168,11 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation
|
||||
protected void mobTick() { mobTick(false); }
|
||||
protected void mobTick(boolean inactive) {
|
||||
this.world.getMethodProfiler().enter("villagerBrain");
|
||||
- if (!inactive) this.getBehaviorController().Wa((WorldServer) this.world, this); // CraftBukkit - decompile error // Paper
|
||||
+ // Purpur start
|
||||
+ boolean tick = (world.getTime() + brainTickOffset) % world.purpurConfig.villagerBrainTicks == 0;
|
||||
+ if (((WorldServer) world).getMinecraftServer().lagging ? tick : world.purpurConfig.villagerUseBrainTicksOnlyWhenLagging || tick)
|
||||
+ // Purpur end
|
||||
+ if (!inactive) this.getBehaviorController().a((WorldServer) this.world, this); // CraftBukkit - decompile error // Paper
|
||||
this.world.getMethodProfiler().exit();
|
||||
if (this.bF) {
|
||||
this.bF = false;
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index c441fcea9..c7fb5a737 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -74,4 +74,11 @@ public class PurpurWorldConfig {
|
||||
playerSpawnInvulnerableTicks = getInt("gameplay-mechanics.player.spawn-invulnerable-ticks", playerSpawnInvulnerableTicks);
|
||||
playerInvulnerableWhileAcceptingResourcePack = getBoolean("gameplay-mechanics.player.invulnerable-while-accepting-resource-pack", playerInvulnerableWhileAcceptingResourcePack);
|
||||
}
|
||||
+
|
||||
+ public int villagerBrainTicks = 1;
|
||||
+ public boolean villagerUseBrainTicksOnlyWhenLagging = true;
|
||||
+ private void villagerSettings() {
|
||||
+ villagerBrainTicks = getInt("mobs.villager.brain-ticks", villagerBrainTicks);
|
||||
+ villagerUseBrainTicksOnlyWhenLagging = getBoolean("mobs.villager.use-brain-ticks-only-when-lagging", villagerUseBrainTicksOnlyWhenLagging);
|
||||
+ }
|
||||
}
|
||||
Reference in New Issue
Block a user