9
0
mirror of https://github.com/SparklyPower/SparklyPaper.git synced 2026-01-04 15:41:34 +00:00

Remove the new patch

Taming villagers is harder than it seems
This commit is contained in:
MrPowerGamerBR
2024-08-26 00:13:32 -03:00
parent 69c85f479a
commit 5c1ca0d8ef
7 changed files with 1 additions and 81 deletions

View File

@@ -1,49 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrPowerGamerBR <git@mrpowergamerbr.com>
Date: Sun, 25 Aug 2024 22:25:56 -0300
Subject: [PATCH] Allow changing the tick rate of mob's "customServerAiStep"
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
index f36a814bfd90af6457171512c131601b19905737..c09ee64f3777b42d4bd7b57e844f366db5992b4d 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -147,6 +147,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
private float restrictRadius;
public boolean aware = true; // CraftBukkit
+ public int customServerAiStepTickRate = 1; // SparklyPaper - allow changing the tick rate of custom server AI steps
protected Mob(EntityType<? extends Mob> type, Level world) {
super(type, world);
@@ -950,7 +951,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
this.navigation.tick();
gameprofilerfiller.pop();
gameprofilerfiller.push("mob tick");
- this.customServerAiStep();
+ if (tickCount % customServerAiStepTickRate == 0) this.customServerAiStep(); // SparklyPaper - allow changing the tick rate of custom server AI steps
gameprofilerfiller.pop();
gameprofilerfiller.push("controls");
gameprofilerfiller.push("move");
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
index 5f9f7e325e3e0276f7a475c4a4725cc0e1b54afd..71d60f72d645abe074c0641b027e716ad4a0b698 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
@@ -192,4 +192,17 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob, io.pape
return io.papermc.paper.entity.PaperLeashable.super.setLeashHolder(holder);
}
// Paper end - Leashable API
+
+ // SparklyPaper - allow changing the tick rate of server AI steps
+ @Override
+ public int getCustomServerAiStepTickRate() {
+ return this.getHandle().customServerAiStepTickRate;
+ }
+
+ @Override
+ public void setCustomServerAiStepTickRate(int newValue) {
+ com.google.common.base.Preconditions.checkArgument(newValue > 0, "newValue cannot be less than or equal to zero");
+ this.getHandle().customServerAiStepTickRate = newValue;
+ }
+ // SparklyPaper end
}

View File

@@ -851,7 +851,7 @@ index 0368d6ba9cc9fe557d3c7172a87a7a5b15445e47..d9dd9f7902dae41b05ba604a829fbe81
entityplayer1.connection = entityplayer.connection;
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 490ee48346395fcbaf2eb0151e9248f18974fea6..43413e1ee5b0287da5c9a75b6a4d24807b89a656 100644
index e0827d8bb3fa17d4f590a5342ff41a514f623e68..3d1558d6f40892a1998dd6ea06f86dfd958b0d03 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -851,7 +851,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess