9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00

Some work

This commit is contained in:
Dreeam
2025-04-07 11:35:31 -04:00
parent 9eca4c0c74
commit 5e1be48cf8
111 changed files with 71 additions and 88 deletions

View File

@@ -1,324 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
Date: Mon, 29 Apr 2024 14:18:58 -0400
Subject: [PATCH] Fix Pufferfish and Purpur patches
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 5fb7a76faf72f7d91122e5bf01c51853164a73c0..011b1a8c13d41c6f1d54d9247b7e61a548f43382 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -277,7 +277,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public static final int TICK_TIME = 1000000000 / MinecraftServer.TPS;
private static final int SAMPLE_INTERVAL = 20; // Paper - improve server tick loop
@Deprecated(forRemoval = true) // Paper
- public final double[] recentTps = new double[3];
+ public final double[] recentTps = new double[4]; // Leaf - Purpur - Add 5 second tps average in /tps
// Spigot end
public volatile boolean hasFullyShutdown; // Paper - Improved watchdog support
public volatile boolean abnormalExit; // Paper - Improved watchdog support
@@ -289,7 +289,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
public boolean lagging = false; // Purpur - Lagging threshold
public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation
protected boolean upnp = false; // Purpur - UPnP Port Forwarding
- public gg.pufferfish.pufferfish.util.AsyncExecutor mobSpawnExecutor = new gg.pufferfish.pufferfish.util.AsyncExecutor("MobSpawning"); // Pufferfish - optimize mob spawning
+ public gg.pufferfish.pufferfish.util.AsyncExecutor mobSpawnExecutor = new gg.pufferfish.pufferfish.util.AsyncExecutor("Leaf Async Mob Spawn Thread"); // Pufferfish - optimize mob spawning // Leaf - Fix Pufferfish and Purpur patches - Unify thread name
public static <S extends MinecraftServer> S spin(Function<Thread, S> threadFunction) {
ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.init(); // Paper - rewrite data converter system
@@ -1250,9 +1250,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
tps15.add(currentTps, diff);
// Backwards compat with bad plugins
- this.recentTps[0] = tps1.getAverage();
- this.recentTps[1] = tps5.getAverage();
- this.recentTps[2] = tps15.getAverage();
+ // Leaf start - Purpur - Add 5 second tps average in /tps
+ this.recentTps[0] = tps5s.getAverage();
+ this.recentTps[1] = tps1.getAverage();
+ this.recentTps[2] = tps5.getAverage();
+ this.recentTps[3] = tps15.getAverage();
+ // Leaf end - Purpur - Add 5 second tps average in /tps
lagging = recentTps[0] < org.purpurmc.purpur.PurpurConfig.laggingThreshold; // Purpur - Lagging threshold
tickSection = currentTime;
}
@@ -1280,7 +1283,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.mayHaveDelayedTasks = true;
this.delayedTasksMaxNextTickTimeNanos = Math.max(Util.getNanos() + l, this.nextTickTimeNanos);
// Purpur start - Configurable TPS Catchup
- if (!org.purpurmc.purpur.PurpurConfig.tpsCatchup /*|| !gg.pufferfish.pufferfish.PufferfishConfig.tpsCatchup*/) { // Purpur - Configurable TPS Catchup
+ if (!org.purpurmc.purpur.PurpurConfig.tpsCatchup) { // Purpur - Configurable TPS Catchup // Leaf - Fix Pufferfish and Purpur patches
this.nextTickTimeNanos = currentTime + l;
this.delayedTasksMaxNextTickTimeNanos = nextTickTimeNanos;
}
diff --git a/net/minecraft/server/gui/StatsComponent.java b/net/minecraft/server/gui/StatsComponent.java
index 35fd539eb2bfe60ad17ab1e558a01273666acc54..445bbdc8da7f1fdbddfc4d8787d78fea9328fb65 100644
--- a/net/minecraft/server/gui/StatsComponent.java
+++ b/net/minecraft/server/gui/StatsComponent.java
@@ -43,7 +43,7 @@ public class StatsComponent extends JComponent {
}
this.msgs[0] = "Memory use: " + l / 1024L / 1024L + " mb (" + Runtime.getRuntime().freeMemory() * 100L / Runtime.getRuntime().maxMemory() + "% free)";
this.msgs[1] = "Avg tick: " + DECIMAL_FORMAT.format((double)this.server.getAverageTickTimeNanos() / TimeUtil.NANOSECONDS_PER_MILLISECOND) + " ms";
- this.msgs[2] = "TPS from last 1m, 5m, 15m: " + String.join(", ", tpsAvg);
+ this.msgs[2] = "TPS from last 5s, 1m, 5m, 15m: " + String.join(", ", tpsAvg); // Leaf - Purpur - Add 5 second tps average in /tps
// Paper end - Improve ServerGUI
this.values[this.vp++ & 0xFF] = (int)(l * 100L / Runtime.getRuntime().maxMemory());
this.repaint();
diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java
index 55f708438e5d71cf14f4e632fc20a65b4bfb7d25..54895ed9ad9b9b2c4c12cfcce89af453c430e3e6 100644
--- a/net/minecraft/server/level/ServerChunkCache.java
+++ b/net/minecraft/server/level/ServerChunkCache.java
@@ -638,7 +638,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
//this.lastSpawnState = spawnState; // Pufferfish - this is managed asynchronously
// Gale start - MultiPaper - skip unnecessary mob spawning computations
} else {
- spawnState = null;
+ lastSpawnState = null; // Leaf - Fix Pufferfish and Purpur patches - Optimize mob spawning
}
// Gale end - MultiPaper - skip unnecessary mob spawning computations
int _int = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 1ba275fd76970774922bcd91bea6bf779bab32b7..a96f4f45d465b6f0e5b061877bd11f3caeeb1625 100644
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1235,7 +1235,7 @@ public class ServerGamePacketListenerImpl
}
if (byteTotal > byteAllowed) {
- ServerGamePacketListenerImpl.LOGGER.warn("{} tried to send too large of a book. Book size: {} - Allowed: {} - Pages: {}", this.player.getScoreboardName(), byteTotal, byteAllowed, pageList.size());
+ ServerGamePacketListenerImpl.LOGGER.warn("{} tried to send a book too large. Book size: {} - Allowed: {} - Pages: {}", this.player.getScoreboardName(), byteTotal, byteAllowed, pageList.size()); // Leaf - Fix Pufferfish and Purpur patches
org.purpurmc.purpur.event.player.PlayerBookTooLargeEvent event = new org.purpurmc.purpur.event.player.PlayerBookTooLargeEvent(player.getBukkitEntity(), itemstack.asBukkitCopy()); if (event.shouldKickPlayer()) // Purpur - PlayerBookTooLargeEvent
this.disconnectAsync(Component.literal("Book too large!"), org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause // Paper - add proper async disconnect
return;
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index a5a8bdecddadac3de1b5a0c1a9849ce1cd52a530..f500f4e32e676712fcd0c877498acc2722baae98 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -533,23 +533,37 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
// Purpur end - Add canSaveToDisk to Entity
+ // Leaf start - Fix Pufferfish and Purpur patches
+ // Gale start - JettPack - optimize sun burn tick - cache eye blockpos
+ private BlockPos cached_eye_blockpos;
+ private net.minecraft.world.phys.Vec3 cached_position;
+ // Gale end - JettPack - optimize sun burn tick - cache eye blockpos
+
// Purpur start - copied from Mob - API for any mob to burn daylight
public boolean isSunBurnTick() {
if (this.level().isDay() && !this.level().isClientSide) {
- float lightLevelDependentMagicValue = this.getLightLevelDependentMagicValue();
- BlockPos blockPos = BlockPos.containing(this.getX(), this.getEyeY(), this.getZ());
- boolean flag = this.isInWaterRainOrBubble() || this.isInPowderSnow || this.wasInPowderSnow;
- if (lightLevelDependentMagicValue > 0.5F
- && this.random.nextFloat() * 30.0F < (lightLevelDependentMagicValue - 0.4F) * 2.0F
- && !flag
- && this.level().canSeeSky(blockPos)) {
- return true;
+ // Gale start - JettPack - optimize sun burn tick - optimizations and cache eye blockpos
+ if (this.cached_position != this.position) {
+ this.cached_eye_blockpos = BlockPos.containing(this.getX(), this.getEyeY(), this.getZ());
+ this.cached_position = this.position;
}
+
+ float lightLevelDependentMagicValue = this.getLightLevelDependentMagicValue(cached_eye_blockpos); // Pass BlockPos to getBrightness
+
+ // Check brightness first
+ if (lightLevelDependentMagicValue <= 0.5F) return false;
+ if (this.random.nextFloat() * 30.0F >= (lightLevelDependentMagicValue - 0.4F) * 2.0F) return false;
+ // Gale end - JettPack - optimize sun burn tick - optimizations and cache eye blockpos
+
+ boolean flag = this.isInWaterRainOrBubble() || this.isInPowderSnow || this.wasInPowderSnow;
+
+ return !flag && this.level().canSeeSky(this.cached_eye_blockpos); // Gale - JettPack - optimize sun burn tick - optimizations and cache eye blockpos
}
- return false;
+ return false; // Gale - JettPack - optimize sun burn tick - optimizations and cache eye blockpos - diff on change
}
// Purpur end - copied from Mob - API for any mob to burn daylight
+ // Leaf end - Fix Pufferfish and Purpur patches
public Entity(EntityType<?> entityType, Level level) {
this.type = entityType;
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index ac006d8738592bc5cb77033adc8c442ce302a476..ce2a9b6c4b903e5285e77f7ee64defd8e81029ae 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -1024,13 +1024,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
// Gale start - Petal - reduce skull ItemStack lookups for reduced visibility
EntityType<?> type = lookingEntity.getType();
// Purpur start - Mob head visibility percent
- if (type == EntityType.SKELETON && itemBySlot.is(Items.SKELETON_SKULL)) {
+ if (type == EntityType.SKELETON && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.SKELETON_SKULL)) { // Leaf - Fix Pufferfish and Purpur patches
d *= lookingEntity.level().purpurConfig.skeletonHeadVisibilityPercent;
- } else if (type == EntityType.ZOMBIE && itemBySlot.is(Items.ZOMBIE_HEAD)) {
+ } else if (type == EntityType.ZOMBIE && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.ZOMBIE_HEAD)) { // Leaf - Fix Pufferfish and Purpur patches
d *= lookingEntity.level().purpurConfig.zombieHeadVisibilityPercent;
- } else if ((type == EntityType.PIGLIN || type == EntityType.PIGLIN_BRUTE) && itemBySlot.is(Items.PIGLIN_HEAD)) {
+ } else if ((type == EntityType.PIGLIN || type == EntityType.PIGLIN_BRUTE) && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.PIGLIN_HEAD)) { // Leaf - Fix Pufferfish and Purpur patches
d *= lookingEntity.level().purpurConfig.piglinHeadVisibilityPercent;
- } else if (type == EntityType.CREEPER && itemBySlot.is(Items.CREEPER_HEAD)) {
+ } else if (type == EntityType.CREEPER && this.getItemBySlot(EquipmentSlot.HEAD).is(Items.CREEPER_HEAD)) { // Leaf - Fix Pufferfish and Purpur patches
d *= lookingEntity.level().purpurConfig.creeperHeadVisibilityPercent;
}
// Purpur end - Mob head visibility percent
diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java
index fbcb803fb575cb1f81afa9d03d5fddbf6352155d..b326c87c1c958bb18fc961010768f7d9f0e414cf 100644
--- a/net/minecraft/world/entity/Mob.java
+++ b/net/minecraft/world/entity/Mob.java
@@ -1632,11 +1632,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
protected void playAttackSound() {
}
- // Gale start - JettPack - optimize sun burn tick - cache eye blockpos
- private BlockPos cached_eye_blockpos;
- private net.minecraft.world.phys.Vec3 cached_position;
- // Gale end - JettPack - optimize sun burn tick - cache eye blockpos
-
public boolean isSunBurnTick() {
// Purpur - implemented in Entity - API for any mob to burn daylight
return super.isSunBurnTick();
diff --git a/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java b/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java
index 135e19e921c9592cec83f6f940f2abe47757fbb8..9fa0c2f09ddfa17a778d4ea8d1ec9314f11a6efd 100644
--- a/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java
+++ b/net/minecraft/world/entity/ai/sensing/SecondaryPoiSensor.java
@@ -22,21 +22,17 @@ public class SecondaryPoiSensor extends Sensor<Villager> {
@Override
protected void doTick(ServerLevel level, Villager entity) {
- // Gale start - Lithium - skip secondary POI sensor if absent
+ // Leaf start - Fix Pufferfish and Purpur patches
+ // Purpur: Option for Villager Clerics to farm Nether Wart - make sure clerics don't wander to soul sand when the option is off
+ // Gale: Lithium - skip secondary POI sensor if absent
var secondaryPoi = entity.getVillagerData().getProfession().secondaryPoi();
-
- if (secondaryPoi.isEmpty()) {
- entity.getBrain().eraseMemory(MemoryModuleType.SECONDARY_JOB_SITE);
- return;
- }
- // Gale end - Lithium - skip secondary POI sensor if absent
- // Purpur start - Option for Villager Clerics to farm Nether Wart - make sure clerics don't wander to soul sand when the option is off
Brain<?> brain = entity.getBrain();
- if (!level.purpurConfig.villagerClericsFarmWarts && entity.getVillagerData().getProfession() == net.minecraft.world.entity.npc.VillagerProfession.CLERIC) {
+
+ if (secondaryPoi.isEmpty() || (!level.purpurConfig.villagerClericsFarmWarts && entity.getVillagerData().getProfession() == net.minecraft.world.entity.npc.VillagerProfession.CLERIC)) {
brain.eraseMemory(MemoryModuleType.SECONDARY_JOB_SITE);
return;
}
- // Purpur end - Option for Villager Clerics to farm Nether Wart
+ // Leaf end - Fix Pufferfish and Purpur patches
ResourceKey<Level> resourceKey = level.dimension();
BlockPos blockPos = entity.blockPosition();
List<GlobalPos> list = Lists.newArrayList();
diff --git a/net/minecraft/world/entity/animal/allay/Allay.java b/net/minecraft/world/entity/animal/allay/Allay.java
index 10d2a1138d814b83ce4233205a7f0ab2ed1f399d..a642533eddd1aca96ad57c2a219f00870a615f71 100644
--- a/net/minecraft/world/entity/animal/allay/Allay.java
+++ b/net/minecraft/world/entity/animal/allay/Allay.java
@@ -287,8 +287,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS
private int behaviorTick = 0; // Pufferfish
@Override
protected void customServerAiStep(ServerLevel level) {
- //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider
- if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider // Leaf - Fix Pufferfish and Purpur patches
this.getBrain().tick(level, this);
AllayAi.updateActivity(this);
super.customServerAiStep(level);
diff --git a/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/net/minecraft/world/entity/animal/axolotl/Axolotl.java
index 1323cedcacd3072cdf5f1eac644688cd098b53db..ad19bbd6989bfb98966872b304f6ece0e869f7a4 100644
--- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java
+++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java
@@ -347,8 +347,7 @@ public class Axolotl extends Animal implements VariantHolder<Axolotl.Variant>, B
private int behaviorTick = 0; // Pufferfish
@Override
protected void customServerAiStep(ServerLevel level) {
- //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider
- if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider // Leaf - Fix Pufferfish and Purpur patches
this.getBrain().tick(level, this);
AxolotlAi.updateActivity(this);
if (!this.isNoAi()) {
diff --git a/net/minecraft/world/entity/animal/frog/Frog.java b/net/minecraft/world/entity/animal/frog/Frog.java
index aca0877319d507c3a672589bd4de5268d7a4c3dc..e5ec23c413e0d7da6f6b9c43925a7aa247946895 100644
--- a/net/minecraft/world/entity/animal/frog/Frog.java
+++ b/net/minecraft/world/entity/animal/frog/Frog.java
@@ -242,8 +242,7 @@ public class Frog extends Animal implements VariantHolder<Holder<FrogVariant>> {
private int behaviorTick = 0; // Pufferfish
@Override
protected void customServerAiStep(ServerLevel level) {
- //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider
- if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider // Leaf - Fix Pufferfish and Purpur patches
this.getBrain().tick(level, this);
FrogAi.updateActivity(this);
super.customServerAiStep(level);
diff --git a/net/minecraft/world/entity/animal/frog/Tadpole.java b/net/minecraft/world/entity/animal/frog/Tadpole.java
index 0ca35514a920dddf230d749bc1a5fe15f1c7940a..ec9db1c12426db80dbf02d704e6c7ec867d59f6f 100644
--- a/net/minecraft/world/entity/animal/frog/Tadpole.java
+++ b/net/minecraft/world/entity/animal/frog/Tadpole.java
@@ -133,8 +133,7 @@ public class Tadpole extends AbstractFish {
private int behaviorTick = 0; // Pufferfish
@Override
protected void customServerAiStep(ServerLevel level) {
- //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider
- if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider // Leaf - Fix Pufferfish and Purpur patches
this.getBrain().tick(level, this);
TadpoleAi.updateActivity(this);
super.customServerAiStep(level);
diff --git a/net/minecraft/world/entity/animal/goat/Goat.java b/net/minecraft/world/entity/animal/goat/Goat.java
index 35d1b99b873d9f8c9aa2a1178a449a8625b18406..9b3ff19b3ce1a4780cab01bae6561d45e60fdddc 100644
--- a/net/minecraft/world/entity/animal/goat/Goat.java
+++ b/net/minecraft/world/entity/animal/goat/Goat.java
@@ -223,8 +223,7 @@ public class Goat extends Animal {
private int behaviorTick = 0; // Pufferfish
@Override
protected void customServerAiStep(ServerLevel level) {
- //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider
- if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider // Leaf - Fix Pufferfish and Purpur patches
this.getBrain().tick(level, this);
GoatAi.updateActivity(this);
super.customServerAiStep(level);
diff --git a/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/net/minecraft/world/entity/monster/hoglin/Hoglin.java
index 7c119b089259add643cd112efac55f92024d0275..f20ae21f38b621b0e3bab887c40bbb8237b87e34 100644
--- a/net/minecraft/world/entity/monster/hoglin/Hoglin.java
+++ b/net/minecraft/world/entity/monster/hoglin/Hoglin.java
@@ -203,8 +203,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase {
private int behaviorTick; // Pufferfish
@Override
protected void customServerAiStep(ServerLevel level) {
- //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider
- if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider // Leaf - Fix Pufferfish and Purpur patches
this.getBrain().tick(level, this);
HoglinAi.updateActivity(this);
if (this.isConverting()) {
diff --git a/net/minecraft/world/entity/monster/piglin/Piglin.java b/net/minecraft/world/entity/monster/piglin/Piglin.java
index 242b2545b6082f567d0bb7900ef06ded3c0fdcdd..fe6eb99ea3d2deda317efe90ecb0987bb367313f 100644
--- a/net/minecraft/world/entity/monster/piglin/Piglin.java
+++ b/net/minecraft/world/entity/monster/piglin/Piglin.java
@@ -382,8 +382,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento
private int behaviorTick; // Pufferfish
@Override
protected void customServerAiStep(ServerLevel level) {
- //if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider
- if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish
+ if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Purpur - only use brain if no rider // Leaf - Fix Pufferfish and Purpur patches
this.getBrain().tick(level, this);
PiglinAi.updateActivity(this);
super.customServerAiStep(level);
diff --git a/net/minecraft/world/entity/projectile/Projectile.java b/net/minecraft/world/entity/projectile/Projectile.java
index a33641dd6e0839fd1b557d8583fe8bb929fcc1cb..d5ef2ec5e15b6d250aafb0b8282b350c03f8ef2c 100644
--- a/net/minecraft/world/entity/projectile/Projectile.java
+++ b/net/minecraft/world/entity/projectile/Projectile.java
@@ -81,7 +81,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
if (maxChunkLoadsPerProjectile >= 0 && this.chunksLoadedByProjectile >= maxChunkLoadsPerProjectile) {
if (maxProjectileChunkLoadsConfig.perProjectile.removeFromWorldAfterReachLimit) {
- this.discard();
+ this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD); // Leaf - Fix Pufferfish and Purpur patches - Purpur
} else if (maxProjectileChunkLoadsConfig.perProjectile.resetMovementAfterReachLimit) {
this.setDeltaMovement(0, this.getDeltaMovement().y, 0);
}

View File

@@ -1,41 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
Date: Mon, 29 Apr 2024 14:18:58 -0400
Subject: [PATCH] Fix Pufferfish and Purpur patches
diff --git a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
index 5b844d2fea387f2cb655169f458ec0ca627f1c65..f267abd6f905180cfa5cf4961cf79f57544a891c 100644
--- a/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
+++ b/src/main/java/io/papermc/paper/ServerBuildInfoImpl.java
@@ -32,9 +32,11 @@ public record ServerBuildInfoImpl(
private static final String BRAND_PAPER_NAME = "Paper";
private static final String BRAND_GALE_NAME = "Gale"; // Gale - branding changes
- // Leaf start - Rebrand
+ // Leaf start - Rebrand & Fix Pufferfish and Purpur patches
+ private static final String BRAND_PUFFERFISH_NAME = "Pufferfish";
+ private static final String BRAND_PURPUR_NAME = "Purpur";
private static final String BRAND_LEAF_NAME = "Leaf";
- // Leaf end - Rebrand
+ // Leaf end - Rebrand & Fix Pufferfish and Purpur patches
private static final String BUILD_DEV = "DEV";
@@ -65,11 +67,13 @@ public record ServerBuildInfoImpl(
@Override
public boolean isBrandCompatible(final @NotNull Key brandId) {
- // Leaf start - Rebrand
+ // Leaf start - Rebrand & Fix Pufferfish and Purpur patches
return brandId.equals(this.brandId)
|| brandId.equals(BRAND_PAPER_ID)
- || brandId.equals(BRAND_GALE_ID); // Gale - branding changes
- // Leaf end - Rebrand
+ || brandId.equals(BRAND_GALE_ID) // Gale - branding changes
+ || brandId.equals(BRAND_PUFFERFISH_ID)
+ || brandId.equals(BRAND_PURPUR_ID);
+ // Leaf end - Rebrand & Fix Pufferfish and Purpur patches
}
@Override