mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-21 02:17:42 +01:00
Add Pufferfish Patches
This commit is contained in:
@@ -5,7 +5,7 @@ Subject: [PATCH] Configurable villager brain ticks
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
index 9a8e08e9a44900ad3899a63992948941abe7c5d8..17eb573debec8e67dab2f5790ba9fc0a1f09a208 100644
|
||||
index 0f466c9301c38e3747a22f116b98d47d1d912601..783cdc4949549725c884cdc0edff485936c77de3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
@@ -137,6 +137,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
@@ -14,9 +14,9 @@ index 9a8e08e9a44900ad3899a63992948941abe7c5d8..17eb573debec8e67dab2f5790ba9fc0a
|
||||
});
|
||||
+ private final int brainTickOffset; // Purpur
|
||||
|
||||
public Villager(EntityType<? extends Villager> entityType, Level world) {
|
||||
this(entityType, world, VillagerType.PLAINS);
|
||||
@@ -149,6 +150,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
public long nextGolemPanic = -1; // Pufferfish
|
||||
|
||||
@@ -151,6 +152,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
this.getNavigation().setCanFloat(true);
|
||||
this.setCanPickUpLoot(true);
|
||||
this.setVillagerData(this.getVillagerData().setType(type).setProfession(VillagerProfession.NONE));
|
||||
@@ -24,17 +24,17 @@ index 9a8e08e9a44900ad3899a63992948941abe7c5d8..17eb573debec8e67dab2f5790ba9fc0a
|
||||
}
|
||||
|
||||
// Purpur start
|
||||
@@ -267,6 +269,10 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
protected void customServerAiStep() { mobTick(false); }
|
||||
protected void mobTick(boolean inactive) {
|
||||
@@ -272,6 +274,10 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
this.level.getProfiler().push("villagerBrain");
|
||||
+ // Purpur start
|
||||
+ boolean tick = (level.getGameTime() + brainTickOffset) % level.purpurConfig.villagerBrainTicks == 0;
|
||||
+ if (((ServerLevel) level).getServer().lagging ? tick : level.purpurConfig.villagerUseBrainTicksOnlyWhenLagging || tick)
|
||||
+ // Purpur end
|
||||
if (!inactive) this.getBrain().tick((ServerLevel) this.level, this); // Paper
|
||||
this.level.getProfiler().pop();
|
||||
if (this.assignProfessionWhenSpawned) {
|
||||
// Pufferfish start
|
||||
if (!inactive) {
|
||||
+ // Purpur start
|
||||
+ boolean tick = (level.getGameTime() + brainTickOffset) % level.purpurConfig.villagerBrainTicks == 0;
|
||||
+ if (((ServerLevel) level).getServer().lagging ? tick : level.purpurConfig.villagerUseBrainTicksOnlyWhenLagging || tick)
|
||||
+ // Purpur end
|
||||
if (getRider() == null && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider
|
||||
this.getBrain().tick((ServerLevel) this.level, this); // Paper
|
||||
}
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 29de4c4316285b7ddf77c508d098584d2cb365e9..ccd3597d78a12d8e6a3514c0f9cfa2aa31b688f8 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
|
||||
Reference in New Issue
Block a user