mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-21 02:17:42 +01:00
3in1: Update Upstream, Remove useless patches, Fix cramming/colliding bug
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
From 89ed1d4a2fd284f22b605416fd768aaec2276702 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 70e8a422a..da3fb4b57 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 f923291fe..3ff26e47b 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
@@ -209,6 +209,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.20.1
|
||||
|
||||
Reference in New Issue
Block a user