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

Join Summit - palm of my hands (Odd Mob Remix)

Genre: Tech House
This commit is contained in:
Dreeam
2025-04-07 17:41:47 -04:00
parent 5e1be48cf8
commit 6a07ebf769
38 changed files with 343 additions and 260 deletions

View File

@@ -1,61 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Taiyou06 <kaandindar21@gmail.com>
Date: Thu, 13 Feb 2025 01:25:40 +0100
Subject: [PATCH] Remove iterators from Inventory#contains
diff --git a/net/minecraft/world/entity/player/Inventory.java b/net/minecraft/world/entity/player/Inventory.java
index 839cbb67d3d38960d9114a4db5bab911b66a573c..e2237ffebadc8f010688c6e7336f4278193a1a20 100644
--- a/net/minecraft/world/entity/player/Inventory.java
+++ b/net/minecraft/world/entity/player/Inventory.java
@@ -568,9 +568,13 @@ public class Inventory implements Container, Nameable {
}
public boolean contains(ItemStack stack) {
- for (List<ItemStack> list : this.compartments) {
- for (ItemStack itemStack : list) {
- if (!itemStack.isEmpty() && ItemStack.isSameItemSameComponents(itemStack, stack)) {
+ // Leaf start - Remove iterators from Inventory#contains
+ for (int i = 0; i < this.compartments.size(); i++) {
+ List<ItemStack> list = this.compartments.get(i);
+ for (int j = 0; j < list.size(); j++) {
+ ItemStack itemstack1 = list.get(j);
+ if (!itemstack1.isEmpty() && ItemStack.isSameItemSameComponents(itemstack1, stack)) {
+ // Leaf end - Remove iterators from Inventory#contains
return true;
}
}
@@ -580,9 +584,13 @@ public class Inventory implements Container, Nameable {
}
public boolean contains(TagKey<Item> tag) {
- for (List<ItemStack> list : this.compartments) {
- for (ItemStack itemStack : list) {
- if (!itemStack.isEmpty() && itemStack.is(tag)) {
+ // Leaf start - Remove iterators from Inventory#contains
+ for (int i = 0; i < this.compartments.size(); i++) {
+ List<ItemStack> list = this.compartments.get(i);
+ for (int j = 0; j < list.size(); j++) {
+ ItemStack itemstack = list.get(j);
+ if (!itemstack.isEmpty() && itemstack.is(tag)) {
+ // Leaf end - Remove iterators from Inventory#contains
return true;
}
}
@@ -592,9 +600,13 @@ public class Inventory implements Container, Nameable {
}
public boolean contains(Predicate<ItemStack> predicate) {
- for (List<ItemStack> list : this.compartments) {
- for (ItemStack itemStack : list) {
- if (predicate.test(itemStack)) {
+ // Leaf start - Remove iterators from Inventory#contains
+ for (int i = 0; i < this.compartments.size(); i++) {
+ List<ItemStack> list = this.compartments.get(i);
+ for (int j = 0; j < list.size(); j++) {
+ ItemStack itemstack = list.get(j);
+ if (predicate.test(itemstack)) {
+ // Leaf end - Remove iterators from Inventory#contains
return true;
}
}

View File

@@ -1,28 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Taiyou06 <kaandindar21@gmail.com>
Date: Sun, 16 Feb 2025 01:13:04 +0100
Subject: [PATCH] Directly use the pre-filtered ticking chunks list as the
output
This patch uses already pre filtered chunks, which completely skips the isChunkNearPlayer check
diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java
index c80464d333bd37a9b8bc7cea2291c8c72e6f9bd6..b1f1b596a597d559aa672a3cb46a03917ad746af 100644
--- a/net/minecraft/server/level/ServerChunkCache.java
+++ b/net/minecraft/server/level/ServerChunkCache.java
@@ -592,14 +592,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
// Leaf end - Use ensureCapacity to pre-populate the size of ticking chunks list output
for (int i = 0; i < size; ++i) {
- final ServerChunkCache.ChunkAndHolder chunkAndHolder = raw[i];
- final LevelChunk levelChunk = chunkAndHolder.chunk();
-
- if (!this.isChunkNearPlayer(chunkMap, levelChunk.getPos(), levelChunk)) {
- continue;
- }
-
- output.add(levelChunk);
+ output.add(raw[i].chunk()); // Leaf - Directly use the pre-filtered ticking chunks list as the output
}
// Paper end - chunk tick iteration optimisation
}

View File

@@ -7,7 +7,7 @@ Original license: MIT
Original project: https://github.com/thebrightspark/AsyncLocator
diff --git a/net/minecraft/server/commands/LocateCommand.java b/net/minecraft/server/commands/LocateCommand.java
index 13bcd8653d766cd0b754a22e9aab261fbc62b0a5..e3e7c4e4da0bc95b015bb84e470477782bdb691c 100644
index 2723d5377567241921fef61952e474c1c0ee9bbf..0918b528e0310b12378e185b29a478ed188a2d58 100644
--- a/net/minecraft/server/commands/LocateCommand.java
+++ b/net/minecraft/server/commands/LocateCommand.java
@@ -109,6 +109,38 @@ public class LocateCommand {
@@ -50,10 +50,10 @@ index 13bcd8653d766cd0b754a22e9aab261fbc62b0a5..e3e7c4e4da0bc95b015bb84e47047778
stopwatch.stop();
if (pair == null) {
diff --git a/net/minecraft/world/entity/animal/Dolphin.java b/net/minecraft/world/entity/animal/Dolphin.java
index 7003b532182737a745491e397a967b72e6b308aa..3ed9652510976770f5661dd7b317f27f046700d4 100644
index 87ba416479df56bad5d13c01e96e92e45b7802a3..2508645b62e7f935dee00fe87b3a6446dbd22cf2 100644
--- a/net/minecraft/world/entity/animal/Dolphin.java
+++ b/net/minecraft/world/entity/animal/Dolphin.java
@@ -500,6 +500,10 @@ public class Dolphin extends AgeableWaterCreature {
@@ -486,6 +486,10 @@ public class Dolphin extends AgeableWaterCreature {
static class DolphinSwimToTreasureGoal extends Goal {
private final Dolphin dolphin;
private boolean stuck;
@@ -64,7 +64,7 @@ index 7003b532182737a745491e397a967b72e6b308aa..3ed9652510976770f5661dd7b317f27f
DolphinSwimToTreasureGoal(Dolphin dolphin) {
this.dolphin = dolphin;
@@ -519,6 +523,11 @@ public class Dolphin extends AgeableWaterCreature {
@@ -505,6 +509,11 @@ public class Dolphin extends AgeableWaterCreature {
@Override
public boolean canContinueToUse() {
@@ -73,10 +73,10 @@ index 7003b532182737a745491e397a967b72e6b308aa..3ed9652510976770f5661dd7b317f27f
+ return true;
+ }
+ // Leaf end - Asynchronous locator
BlockPos treasurePos = this.dolphin.getTreasurePos();
return !BlockPos.containing(treasurePos.getX(), this.dolphin.getY(), treasurePos.getZ()).closerToCenterThan(this.dolphin.position(), 4.0)
&& !this.stuck
@@ -532,6 +541,22 @@ public class Dolphin extends AgeableWaterCreature {
BlockPos blockPos = this.dolphin.treasurePos;
return blockPos != null
&& !BlockPos.containing(blockPos.getX(), this.dolphin.getY(), blockPos.getZ()).closerToCenterThan(this.dolphin.position(), 4.0)
@@ -519,6 +528,22 @@ public class Dolphin extends AgeableWaterCreature {
this.stuck = false;
this.dolphin.getNavigation().stop();
BlockPos blockPos = this.dolphin.blockPosition();
@@ -86,7 +86,7 @@ index 7003b532182737a745491e397a967b72e6b308aa..3ed9652510976770f5661dd7b317f27f
+ .thenOnServerThread(pos -> {
+ asyncLocator$locateTask = null;
+ if (pos != null) {
+ this.dolphin.setTreasurePos(pos);
+ this.dolphin.treasurePos = pos;
+ serverLevel.broadcastEntityEvent(this.dolphin, (byte) 38);
+ } else {
+ this.stuck = true;
@@ -98,8 +98,8 @@ index 7003b532182737a745491e397a967b72e6b308aa..3ed9652510976770f5661dd7b317f27f
+ // Leaf end - Asynchronous locator
BlockPos blockPos1 = serverLevel.findNearestMapStructure(StructureTags.DOLPHIN_LOCATED, blockPos, 50, false);
if (blockPos1 != null) {
this.dolphin.setTreasurePos(blockPos1);
@@ -544,6 +569,12 @@ public class Dolphin extends AgeableWaterCreature {
this.dolphin.treasurePos = blockPos1;
@@ -531,6 +556,12 @@ public class Dolphin extends AgeableWaterCreature {
@Override
public void stop() {
@@ -109,10 +109,10 @@ index 7003b532182737a745491e397a967b72e6b308aa..3ed9652510976770f5661dd7b317f27f
+ this.asyncLocator$locateTask = null;
+ }
+ // Leaf end - Asynchronous locator
BlockPos treasurePos = this.dolphin.getTreasurePos();
if (BlockPos.containing(treasurePos.getX(), this.dolphin.getY(), treasurePos.getZ()).closerToCenterThan(this.dolphin.position(), 4.0) || this.stuck
)
@@ -554,6 +585,11 @@ public class Dolphin extends AgeableWaterCreature {
BlockPos blockPos = this.dolphin.treasurePos;
if (blockPos == null
|| BlockPos.containing(blockPos.getX(), this.dolphin.getY(), blockPos.getZ()).closerToCenterThan(this.dolphin.position(), 4.0)
@@ -541,6 +572,11 @@ public class Dolphin extends AgeableWaterCreature {
@Override
public void tick() {
@@ -121,14 +121,14 @@ index 7003b532182737a745491e397a967b72e6b308aa..3ed9652510976770f5661dd7b317f27f
+ return;
+ }
+ // Leaf end - Asynchronous locator
Level level = this.dolphin.level();
if (this.dolphin.closeToNextPos() || this.dolphin.getNavigation().isDone()) {
Vec3 vec3 = Vec3.atCenterOf(this.dolphin.getTreasurePos());
if (this.dolphin.treasurePos != null) {
Level level = this.dolphin.level();
if (this.dolphin.closeToNextPos() || this.dolphin.getNavigation().isDone()) {
diff --git a/net/minecraft/world/entity/projectile/EyeOfEnder.java b/net/minecraft/world/entity/projectile/EyeOfEnder.java
index 01a9bad80a30a7879a69b800258b616b4d986108..d4f49e40461a165ebd6635e9fec8fe56d7f1acf6 100644
index 59941c605085d93357211939114ecf1b88aef05d..74ffcc5417dd20635a52a3e799436eaf18076a0e 100644
--- a/net/minecraft/world/entity/projectile/EyeOfEnder.java
+++ b/net/minecraft/world/entity/projectile/EyeOfEnder.java
@@ -26,6 +26,7 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
@@ -29,6 +29,7 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
public double tz;
public int life;
public boolean surviveAfterDeath;
@@ -136,7 +136,7 @@ index 01a9bad80a30a7879a69b800258b616b4d986108..d4f49e40461a165ebd6635e9fec8fe56
public EyeOfEnder(EntityType<? extends EyeOfEnder> entityType, Level level) {
super(entityType, level);
@@ -112,6 +113,11 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
@@ -116,6 +117,11 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
@Override
public void tick() {
super.tick();
@@ -149,10 +149,10 @@ index 01a9bad80a30a7879a69b800258b616b4d986108..d4f49e40461a165ebd6635e9fec8fe56
double d = this.getX() + deltaMovement.x;
double d1 = this.getY() + deltaMovement.y;
diff --git a/net/minecraft/world/item/EnderEyeItem.java b/net/minecraft/world/item/EnderEyeItem.java
index 02f2c38b5f9a503097dea44d5c79518b03b63f9a..a7aa09d7c9d5f95706349e426cd54a79e963c6f9 100644
index 68f33de233b716055f791fd87fe3be981580375c..bd60cc8f7e37cba981792412a8ce7f71ea8b33f5 100644
--- a/net/minecraft/world/item/EnderEyeItem.java
+++ b/net/minecraft/world/item/EnderEyeItem.java
@@ -103,14 +103,47 @@ public class EnderEyeItem extends Item {
@@ -105,14 +105,47 @@ public class EnderEyeItem extends Item {
} else {
player.startUsingItem(hand);
if (level instanceof ServerLevel serverLevel) {
@@ -202,7 +202,7 @@ index 02f2c38b5f9a503097dea44d5c79518b03b63f9a..a7aa09d7c9d5f95706349e426cd54a79
level.gameEvent(GameEvent.PROJECTILE_SHOOT, eyeOfEnder.position(), GameEvent.Context.of(player));
// CraftBukkit start
if (!level.addFreshEntity(eyeOfEnder)) {
@@ -124,7 +157,7 @@ public class EnderEyeItem extends Item {
@@ -126,7 +159,7 @@ public class EnderEyeItem extends Item {
float f = Mth.lerp(level.random.nextFloat(), 0.33F, 0.5F);
level.playSound(null, player.getX(), player.getY(), player.getZ(), SoundEvents.ENDER_EYE_LAUNCH, SoundSource.NEUTRAL, 1.0F, f);
itemInHand.consume(1, player);

View File

@@ -7,10 +7,10 @@ Original license: GPLv3
Original project: https://github.com/embeddedt/ModernFix
diff --git a/net/minecraft/nbt/CompoundTag.java b/net/minecraft/nbt/CompoundTag.java
index 3bce1e8ef90e95abd8b1111f1160f952d2493e69..468566e8175d71e1562a80fae8e5f0cd32318c35 100644
index 052ca6beb06a3256fdf04bac5f2085ad622d7df0..bc6ddaac8cb6c3a5353ad434ae8167607fd21abc 100644
--- a/net/minecraft/nbt/CompoundTag.java
+++ b/net/minecraft/nbt/CompoundTag.java
@@ -49,7 +49,7 @@ public class CompoundTag implements Tag {
@@ -54,7 +54,7 @@ public final class CompoundTag implements Tag {
private static CompoundTag loadCompound(DataInput input, NbtAccounter nbtAccounter) throws IOException {
nbtAccounter.accountBytes(48L);
@@ -19,7 +19,7 @@ index 3bce1e8ef90e95abd8b1111f1160f952d2493e69..468566e8175d71e1562a80fae8e5f0cd
byte b;
while ((b = input.readByte()) != 0) {
@@ -166,7 +166,7 @@ public class CompoundTag implements Tag {
@@ -171,7 +171,7 @@ public final class CompoundTag implements Tag {
}
public CompoundTag() {
@@ -28,7 +28,7 @@ index 3bce1e8ef90e95abd8b1111f1160f952d2493e69..468566e8175d71e1562a80fae8e5f0cd
}
@Override
@@ -497,6 +497,11 @@ public class CompoundTag implements Tag {
@@ -402,6 +402,11 @@ public final class CompoundTag implements Tag {
@Override
public CompoundTag copy() {

View File

@@ -8,10 +8,10 @@ avoids multiple casting in Entity#distanceTo, using Math#sqrt directly instead o
these methods more able to be inlined by the JIT compiler.
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 4d88aa70c01e03baf8aea897b00f335c7be91f46..4544dd876d3cbcdb9b774b4a1f0c4737f3124bc5 100644
index 753515c65a2b49db15ef6616cc7caf276fdbbeb1..a2e9306d9a5eef738f8225e98fb1cc1f4bbca504 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -2194,31 +2194,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -2186,31 +2186,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return new Vec3(this.xOld, this.yOld, this.zOld);
}
@@ -43,7 +43,7 @@ index 4d88aa70c01e03baf8aea897b00f335c7be91f46..4544dd876d3cbcdb9b774b4a1f0c4737
public void playerTouch(Player player) {
}
@@ -5230,4 +5205,34 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -5248,4 +5223,34 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return false;
}
// Purpur end - Ridables

View File

@@ -9,15 +9,15 @@ Original project: https://github.com/starlis/empirecraft
Also see Leaf's EMC-Don-t-use-snapshots-for-acquiring-blockstate
diff --git a/net/minecraft/world/level/block/entity/BlockEntity.java b/net/minecraft/world/level/block/entity/BlockEntity.java
index 3fd0f42618e5c2c683335d1d3e0bb74c6d32ef66..8f4d13d897ac92c6ea239da22029c8058bd82eaa 100644
index d7a08a4ecac2bb4f5626fb53e27f8d50b6936f1c..129af0e69a3ec9525756b6825b795e4441de66c9 100644
--- a/net/minecraft/world/level/block/entity/BlockEntity.java
+++ b/net/minecraft/world/level/block/entity/BlockEntity.java
@@ -361,7 +361,7 @@ public abstract class BlockEntity {
@@ -363,7 +363,7 @@ public abstract class BlockEntity {
// CraftBukkit start - add method
public org.bukkit.inventory.InventoryHolder getOwner() {
// Paper start
- return getOwner(true);
+ return getOwner(org.dreeam.leaf.config.modules.opt.TileEntitySnapshotCreation.enabled); // Leaf - EMC - Don't use snapshots for TileEntity::getOwner
}
public org.bukkit.inventory.InventoryHolder getOwner(boolean useSnapshot) {
// Paper end

View File

@@ -6,10 +6,10 @@ Subject: [PATCH] Cache tile entity position
Dreeam TODO: Check if there is a way to cache isRemoved without problem
diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java
index 290163335cf3967e2745442fd7d4d4fa16fb7bc0..238e015d4ff5fabb99e569118f253366d545d269 100644
index 800fc055024c176d1830e1d2686f5d96131c8712..5325989f46bd288c5a6f1362ec17d3354d55abfd 100644
--- a/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/net/minecraft/world/level/chunk/LevelChunk.java
@@ -936,10 +936,12 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
@@ -940,10 +940,12 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
private final T blockEntity;
private final BlockEntityTicker<T> ticker;
private boolean loggedInvalidBlockState;
@@ -22,7 +22,7 @@ index 290163335cf3967e2745442fd7d4d4fa16fb7bc0..238e015d4ff5fabb99e569118f253366
}
@Override
@@ -980,7 +982,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
@@ -984,7 +986,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
@Override
public BlockPos getPos() {
@@ -31,7 +31,7 @@ index 290163335cf3967e2745442fd7d4d4fa16fb7bc0..238e015d4ff5fabb99e569118f253366
}
@Override
@@ -1007,13 +1009,16 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
@@ -1011,13 +1013,16 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
static class RebindableTickingBlockEntityWrapper implements TickingBlockEntity {
private TickingBlockEntity ticker;
@@ -48,7 +48,7 @@ index 290163335cf3967e2745442fd7d4d4fa16fb7bc0..238e015d4ff5fabb99e569118f253366
}
@Override
@@ -1028,7 +1033,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
@@ -1032,7 +1037,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
@Override
public BlockPos getPos() {

View File

@@ -7,10 +7,10 @@ Original license: AGPL-3.0
Original project: https://github.com/snackbag/TT20
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 1cb60107d95296fc9e2c106d70838c057564abeb..c50a301a0c2365c2052aefc6a23fcf6fa82e1b9d 100644
index 354823def23167feb1e7b35cd9db5ef1584e7e8c..ae1cff1416cd57977d755056307252118e6ae821 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -1556,6 +1556,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1554,6 +1554,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.server.spark.tickStart(); // Paper - spark
new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.tickCount+1).callEvent(); // Paper - Server Tick Events
@@ -19,10 +19,10 @@ index 1cb60107d95296fc9e2c106d70838c057564abeb..c50a301a0c2365c2052aefc6a23fcf6f
this.tickRateManager.tick();
this.tickChildren(hasTimeLeft);
diff --git a/net/minecraft/world/level/material/LavaFluid.java b/net/minecraft/world/level/material/LavaFluid.java
index 85629a43f5469a89dd6078d879f475e8212438ec..d66321acb26682a02efa02cf1443b40d2a17f67b 100644
index 43cdc2f8fdfdeb1426e386e0084087779ef62754..5984ea9f6236a80b666fe6c33a99245389b54e8f 100644
--- a/net/minecraft/world/level/material/LavaFluid.java
+++ b/net/minecraft/world/level/material/LavaFluid.java
@@ -177,7 +177,13 @@ public abstract class LavaFluid extends FlowingFluid {
@@ -189,7 +189,13 @@ public abstract class LavaFluid extends FlowingFluid {
@Override
public int getTickDelay(LevelReader level) {
@@ -38,10 +38,10 @@ index 85629a43f5469a89dd6078d879f475e8212438ec..d66321acb26682a02efa02cf1443b40d
@Override
diff --git a/net/minecraft/world/level/material/WaterFluid.java b/net/minecraft/world/level/material/WaterFluid.java
index 2e4fed7c27910b6c886f710f33b0841c2a175837..508036525272ffdda054bd631bebd05e82d28409 100644
index b248fe1d66940c05d56fc322df61c52ece72e77f..361de86f003da8b9434c3cb5da5c8e79d6cd3e86 100644
--- a/net/minecraft/world/level/material/WaterFluid.java
+++ b/net/minecraft/world/level/material/WaterFluid.java
@@ -115,7 +115,13 @@ public abstract class WaterFluid extends FlowingFluid {
@@ -126,7 +126,13 @@ public abstract class WaterFluid extends FlowingFluid {
@Override
public int getTickDelay(LevelReader level) {

View File

@@ -12,10 +12,10 @@ As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric)
Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index 316242d60db43494300a29b7d0945d0d76ac9987..0138bd4d95a592bfa5ccbb33fa6c1201f289fd2a 100644
index f36af61d7620f57f396d879d669161b8b1a30875..eb40f810d4eb8d6a8cc130719b637a473f19cc82 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -2739,6 +2739,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -2796,6 +2796,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
protected void updateSwingTime() {
@@ -23,7 +23,7 @@ index 316242d60db43494300a29b7d0945d0d76ac9987..0138bd4d95a592bfa5ccbb33fa6c1201
int currentSwingDuration = this.getCurrentSwingDuration();
if (this.swinging) {
this.swingTime++;
@@ -3690,6 +3691,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3704,6 +3705,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
protected void updateFallFlying() {
this.checkSlowFallDistance();
if (!this.level().isClientSide) {

View File

@@ -11,10 +11,10 @@ As part of: Lithium (https://github.com/CaffeineMC/lithium-fabric)
Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)
diff --git a/net/minecraft/core/Direction.java b/net/minecraft/core/Direction.java
index 216f97207dac88cc1dc3df59c6ee8a62c7614b4a..3a76b1ec8570e4c9f328e9d362b41057b092be45 100644
index 63fd7b45750430b565d599337d3112cbaa7e7550..1363c80e7c7be20c52a947f2eb6fabc5e5b6c97c 100644
--- a/net/minecraft/core/Direction.java
+++ b/net/minecraft/core/Direction.java
@@ -217,7 +217,7 @@ public enum Direction implements StringRepresentable, ca.spottedleaf.moonrise.pa
@@ -222,7 +222,7 @@ public enum Direction implements StringRepresentable, ca.spottedleaf.moonrise.pa
}
public Direction getOpposite() {
@@ -23,7 +23,7 @@ index 216f97207dac88cc1dc3df59c6ee8a62c7614b4a..3a76b1ec8570e4c9f328e9d362b41057
}
public Direction getClockWise(Direction.Axis axis) {
@@ -350,7 +350,7 @@ public enum Direction implements StringRepresentable, ca.spottedleaf.moonrise.pa
@@ -355,7 +355,7 @@ public enum Direction implements StringRepresentable, ca.spottedleaf.moonrise.pa
}
public static Direction getRandom(RandomSource random) {
@@ -33,10 +33,10 @@ index 216f97207dac88cc1dc3df59c6ee8a62c7614b4a..3a76b1ec8570e4c9f328e9d362b41057
public static Direction getApproximateNearest(double x, double y, double z) {
diff --git a/net/minecraft/world/phys/AABB.java b/net/minecraft/world/phys/AABB.java
index c9c6e4e460ad8435f12761704bb9b0284d6aa708..f64c04b32dd2d0fe143fc8bf9f498e52beb66a58 100644
index 5767fbfd7f33c5276fb4335ce473b2e1baca411c..939fe337c8c1fa52bc0d95cff6d6a735e1125738 100644
--- a/net/minecraft/world/phys/AABB.java
+++ b/net/minecraft/world/phys/AABB.java
@@ -18,6 +18,15 @@ public class AABB {
@@ -19,6 +19,15 @@ public class AABB {
public final double maxY;
public final double maxZ;
@@ -52,7 +52,7 @@ index c9c6e4e460ad8435f12761704bb9b0284d6aa708..f64c04b32dd2d0fe143fc8bf9f498e52
public AABB(double x1, double y1, double z1, double x2, double y2, double z2) {
this.minX = Math.min(x1, x2);
this.minY = Math.min(y1, y2);
@@ -79,11 +88,33 @@ public class AABB {
@@ -80,11 +89,33 @@ public class AABB {
}
public double min(Direction.Axis axis) {

View File

@@ -9,10 +9,10 @@ happen but the visual "refresh" of a world change is hidden. Depending on the de
this can act as a "smooth teleport" to a world if the new world is very similar looking to the old one.
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index 2a3c38cd8e31f73eca2508ad94e46ace980de50c..336215befa7eb4b20fc86f224a019080cea70113 100644
index 291d1ca6df397bba0c85480ab678c481fa59914d..2ad0c935e16b92007475c681641770aa27f2b0c3 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -1475,6 +1475,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -1418,6 +1418,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
LevelData worlddata = level.getLevelData();
this.connection.send(new ClientboundRespawnPacket(this.createCommonSpawnInfo(level), (byte) 3));
@@ -20,9 +20,9 @@ index 2a3c38cd8e31f73eca2508ad94e46ace980de50c..336215befa7eb4b20fc86f224a019080
this.connection.send(new ClientboundChangeDifficultyPacket(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
PlayerList playerList = this.server.getPlayerList();
@@ -1484,7 +1485,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -1427,7 +1428,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
// CraftBukkit end
this.portalPos = io.papermc.paper.util.MCUtil.toBlockPosition(exit); // Purpur - Fix stuck in portals
this.portalPos = org.bukkit.craftbukkit.util.CraftLocation.toBlockPosition(exit); // Purpur - Fix stuck in portals
this.setServerLevel(level);
- this.connection.internalTeleport(PositionMoveRotation.of(teleportTransition), teleportTransition.relatives()); // CraftBukkit - use internal teleport without event
+ if (!org.dreeam.leaf.config.modules.gameplay.SmoothTeleport.enabled || !PlayerList.isSameLogicalHeight(serverLevel, level)) this.connection.internalTeleport(PositionMoveRotation.of(teleportTransition), teleportTransition.relatives()); // CraftBukkit - use internal teleport without event // Leaf - Smooth teleport
@@ -30,10 +30,10 @@ index 2a3c38cd8e31f73eca2508ad94e46ace980de50c..336215befa7eb4b20fc86f224a019080
level.addDuringTeleport(this);
this.triggerDimensionChangeTriggers(serverLevel);
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
index bda8e9e23f63a6eb27f71fc795ad6495e62f00f2..f59662da0bbfe0e768c4ac5c7491d13263ac5cac 100644
index 4bc7e2c569223779d3c8c556a62d81c092481f70..b98b0f7983548b45493fce128d886ac826ebdeaf 100644
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -955,11 +955,11 @@ public abstract class PlayerList {
@@ -797,11 +797,11 @@ public abstract class PlayerList {
byte b = (byte)(keepInventory ? 1 : 0);
ServerLevel serverLevel = serverPlayer.serverLevel();
LevelData levelData = serverLevel.getLevelData();

View File

@@ -108,10 +108,10 @@ index e111adec2116f922fe67ee434635e50c60dad15c..72f64d5812411be0f0bc5456caff87d6
+ // Leaf end - Use faster and thread-safe ban list date format parsing
}
diff --git a/net/minecraft/server/players/OldUsersConverter.java b/net/minecraft/server/players/OldUsersConverter.java
index 7dbcd9d96f052bb10127ad2b061154c23cc9ffd4..0a3b159a8629fad1a240b9be3e6025bfa1183a00 100644
index 194082763f41a58dc8ee0241a2eeb6dd39dff88d..b39eeaf1515792ccd36d090045f958e2616f65c2 100644
--- a/net/minecraft/server/players/OldUsersConverter.java
+++ b/net/minecraft/server/players/OldUsersConverter.java
@@ -469,8 +469,10 @@ public class OldUsersConverter {
@@ -466,8 +466,10 @@ public class OldUsersConverter {
static Date parseDate(String input, Date defaultValue) {
Date date;
try {

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Collect then startEachNonRunningBehavior in Brain
diff --git a/net/minecraft/world/entity/ai/Brain.java b/net/minecraft/world/entity/ai/Brain.java
index c561b749fb9b76ba9b1e9689089b743248c65d50..ea6c8e85ccff67b1c24109732f74f1e8199cad07 100644
index b946faf899561b9e4f8399e16600eede54bb55a5..b2e17d387558875f45a8458cf874a5b056820432 100644
--- a/net/minecraft/world/entity/ai/Brain.java
+++ b/net/minecraft/world/entity/ai/Brain.java
@@ -453,20 +453,29 @@ public class Brain<E extends LivingEntity> {
@@ -462,20 +462,29 @@ public class Brain<E extends LivingEntity> {
}
private void startEachNonRunningBehavior(ServerLevel level, E entity) {

View File

@@ -32,10 +32,10 @@ index 55ce935a2fab7e32904d9ff599867269035d703f..6e2b2d258e47dcca30a5ad9f4f492598
public int getMiddleBlockX() {
diff --git a/net/minecraft/world/level/levelgen/Beardifier.java b/net/minecraft/world/level/levelgen/Beardifier.java
index 131923282c9ecbcb1d7f45a826da907c02bd2716..47b6519f40ed978c05d93023a0cdc1c9e13f033f 100644
index 74d8202b5c9bb2a3ee832be70f95c0b5cbecb460..9ea92c7beee917e47f02e24982bb97ff7eee7c7d 100644
--- a/net/minecraft/world/level/levelgen/Beardifier.java
+++ b/net/minecraft/world/level/levelgen/Beardifier.java
@@ -132,8 +132,15 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker {
@@ -131,8 +131,15 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker {
}
private static double getBuryContribution(double x, double y, double z) {

View File

@@ -31,50 +31,50 @@ index 1b8193587814225c2ef2c5d9e667436eb50ff6c5..288a3eb57f3431dd624ad8a4b0868456
public ReferenceList<ServerPlayer> getPlayersByChunk(final int chunkX, final int chunkZ, final NearbyMapType type) {
diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java
index b5817aa8f537593f6d9fc6b612c82ccccb250ac7..be820c6093dd2ae7642b9bee11edf65e3a8d7242 100644
index f473999938840562b1007a789600342e5796a123..ea4010df54dbd17cdae22d671ea1e4bd7b685b3e 100644
--- a/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/scheduling/ChunkHolderManager.java
@@ -506,7 +506,7 @@ public final class ChunkHolderManager {
@@ -540,7 +540,7 @@ public final class ChunkHolderManager {
public <T> boolean addTicketAtLevel(final TicketType<T> type, final ChunkPos chunkPos, final int level,
public <T> boolean addTicketAtLevel(final TicketType type, final ChunkPos chunkPos, final int level,
final T identifier) {
- return this.addTicketAtLevel(type, CoordinateUtils.getChunkKey(chunkPos), level, identifier);
+ return this.addTicketAtLevel(type, chunkPos.longKey, level, identifier); // Leaf - Cache chunk key
}
public <T> boolean addTicketAtLevel(final TicketType<T> type, final int chunkX, final int chunkZ, final int level,
@@ -604,7 +604,7 @@ public final class ChunkHolderManager {
public <T> boolean addTicketAtLevel(final TicketType type, final int chunkX, final int chunkZ, final int level,
@@ -687,7 +687,7 @@ public final class ChunkHolderManager {
}
public <T> boolean removeTicketAtLevel(final TicketType<T> type, final ChunkPos chunkPos, final int level, final T identifier) {
public <T> boolean removeTicketAtLevel(final TicketType type, final ChunkPos chunkPos, final int level, final T identifier) {
- return this.removeTicketAtLevel(type, CoordinateUtils.getChunkKey(chunkPos), level, identifier);
+ return this.removeTicketAtLevel(type, chunkPos.longKey, level, identifier); // Leaf - Cache chunk key
}
public <T> boolean removeTicketAtLevel(final TicketType<T> type, final int chunkX, final int chunkZ, final int level, final T identifier) {
@@ -1224,7 +1224,7 @@ public final class ChunkHolderManager {
public <T> boolean removeTicketAtLevel(final TicketType type, final int chunkX, final int chunkZ, final int level, final T identifier) {
@@ -1309,7 +1309,7 @@ public final class ChunkHolderManager {
}
public static <T> TicketOperation<T, T> addOp(final ChunkPos chunk, final TicketType<T> type, final int ticketLevel, final T identifier) {
public static <T> TicketOperation<T, T> addOp(final ChunkPos chunk, final TicketType type, final int ticketLevel, final T identifier) {
- return addOp(CoordinateUtils.getChunkKey(chunk), type, ticketLevel, identifier);
+ return addOp(chunk.longKey, type, ticketLevel, identifier); // Leaf - Cache chunk key
}
public static <T> TicketOperation<T, T> addOp(final int chunkX, final int chunkZ, final TicketType<T> type, final int ticketLevel, final T identifier) {
@@ -1236,7 +1236,7 @@ public final class ChunkHolderManager {
public static <T> TicketOperation<T, T> addOp(final int chunkX, final int chunkZ, final TicketType type, final int ticketLevel, final T identifier) {
@@ -1321,7 +1321,7 @@ public final class ChunkHolderManager {
}
public static <T> TicketOperation<T, T> removeOp(final ChunkPos chunk, final TicketType<T> type, final int ticketLevel, final T identifier) {
public static <T> TicketOperation<T, T> removeOp(final ChunkPos chunk, final TicketType type, final int ticketLevel, final T identifier) {
- return removeOp(CoordinateUtils.getChunkKey(chunk), type, ticketLevel, identifier);
+ return removeOp(chunk.longKey, type, ticketLevel, identifier); // Leaf - Cache chunk key
}
public static <T> TicketOperation<T, T> removeOp(final int chunkX, final int chunkZ, final TicketType<T> type, final int ticketLevel, final T identifier) {
public static <T> TicketOperation<T, T> removeOp(final int chunkX, final int chunkZ, final TicketType type, final int ticketLevel, final T identifier) {
diff --git a/ca/spottedleaf/moonrise/patches/starlight/light/StarLightInterface.java b/ca/spottedleaf/moonrise/patches/starlight/light/StarLightInterface.java
index 571db5f9bf94745a8afe2cd313e593fb15db5e37..1487b7d8be435b3fbad2aabd05796965b4775a87 100644
index 51f4dd4f583dfbd16cb00f1cb4418d1044cecb1c..e1812910d7c3941dec3d4f1c90f4cf966a631de3 100644
--- a/ca/spottedleaf/moonrise/patches/starlight/light/StarLightInterface.java
+++ b/ca/spottedleaf/moonrise/patches/starlight/light/StarLightInterface.java
@@ -818,7 +818,7 @@ public final class StarLightInterface {
@@ -817,7 +817,7 @@ public final class StarLightInterface {
}
public ServerChunkTasks queueChunkLightTask(final ChunkPos pos, final BooleanSupplier lightTask, final Priority priority) {
@@ -83,11 +83,24 @@ index 571db5f9bf94745a8afe2cd313e593fb15db5e37..1487b7d8be435b3fbad2aabd05796965
if (valueInMap == null) {
valueInMap = new ServerChunkTasks(
keyInMap, ServerLightQueue.this.lightInterface, ServerLightQueue.this, priority
diff --git a/net/minecraft/server/level/DistanceManager.java b/net/minecraft/server/level/DistanceManager.java
index fd3d0f6cb53bc8b6186f0d86575f21007b2c20ed..cddeeab73e7b981701a42c5aad6b47778d46b792 100644
--- a/net/minecraft/server/level/DistanceManager.java
+++ b/net/minecraft/server/level/DistanceManager.java
@@ -178,7 +178,7 @@ public abstract class DistanceManager implements ca.spottedleaf.moonrise.patches
for (int i = 0; i < size; ++i) {
final LevelChunk chunk = raw[i];
- action.accept(ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkKey(chunk.getPos()));
+ action.accept(chunk.coordinateKey); // Leaf - Cache chunk key
}
// Paper end - rewrite chunk system
}
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index 5423d8228c1da56135ae32b958f432d5b94707ed..95bed1e67758543a7aec12eee1229ee2c4057c88 100644
index 889b7e8752129dd3b5ba196c4b29449615499515..b9bff011c0ffb0efdaccc65847be69aad1a70681 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -508,7 +508,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -503,7 +503,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@Override
public final void moonrise$markChunkForPlayerTicking(final LevelChunk chunk) {
final ChunkPos pos = chunk.getPos();
@@ -96,15 +109,24 @@ index 5423d8228c1da56135ae32b958f432d5b94707ed..95bed1e67758543a7aec12eee1229ee2
return;
}
@@ -2569,7 +2569,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -2543,7 +2543,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
public boolean isNaturalSpawningAllowed(ChunkPos chunkPos) {
public boolean areEntitiesActuallyLoadedAndTicking(ChunkPos chunkPos) {
// Paper start - rewrite chunk system
- final ca.spottedleaf.moonrise.patches.chunk_system.scheduling.NewChunkHolder chunkHolder = this.moonrise$getChunkTaskScheduler().chunkHolderManager.getChunkHolder(ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkKey(chunkPos));
+ final ca.spottedleaf.moonrise.patches.chunk_system.scheduling.NewChunkHolder chunkHolder = this.moonrise$getChunkTaskScheduler().chunkHolderManager.getChunkHolder(chunkPos.longKey); // Leaf - Cache chunk key
return chunkHolder != null && chunkHolder.isEntityTickingReady();
// Paper end - rewrite chunk system
}
@@ -2558,7 +2558,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
public boolean canSpawnEntitiesInChunk(ChunkPos chunkPos) {
// Paper start - rewrite chunk system
- final ca.spottedleaf.moonrise.patches.chunk_system.scheduling.NewChunkHolder chunkHolder = this.moonrise$getChunkTaskScheduler().chunkHolderManager.getChunkHolder(ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkKey(chunkPos));
+ final ca.spottedleaf.moonrise.patches.chunk_system.scheduling.NewChunkHolder chunkHolder = this.moonrise$getChunkTaskScheduler().chunkHolderManager.getChunkHolder(chunkPos.longKey); // Leaf - Cache chunk key
return chunkHolder != null && chunkHolder.isEntityTickingReady() && this.getWorldBorder().isWithinBounds(chunkPos);
// Paper end - rewrite chunk system
}
diff --git a/net/minecraft/world/level/ChunkPos.java b/net/minecraft/world/level/ChunkPos.java
index 6e2b2d258e47dcca30a5ad9f4f492598f2bc21fb..f9af074e833a6dab96414750314a27b35ec07bfc 100644
--- a/net/minecraft/world/level/ChunkPos.java

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Cache random tick block status
diff --git a/net/minecraft/world/level/chunk/LevelChunkSection.java b/net/minecraft/world/level/chunk/LevelChunkSection.java
index 412e7b1cf8c24f0ddf6d174967bedad576f10aba..b8ac6a9ba7b56ccd034757f7d135d272b8e69e90 100644
index 03edf6dc751cc59ae1f16c23340e41668350b32a..963c51d14f87d2557a3d686fb8fe3ec9cba367b3 100644
--- a/net/minecraft/world/level/chunk/LevelChunkSection.java
+++ b/net/minecraft/world/level/chunk/LevelChunkSection.java
@@ -21,6 +21,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_

View File

@@ -10,10 +10,10 @@ which the contains iteration call is very expensive if called everytime
In the test, it can improve ~30% performance in ~1577000 times of canHoldAnyFluid calls (~159ms -> ~111ms)
diff --git a/net/minecraft/world/level/block/state/BlockBehaviour.java b/net/minecraft/world/level/block/state/BlockBehaviour.java
index 7f46f33fa565fa1a3aedce5524f19be8ba420352..d35211b0cae66b1a40e89539507e55973313f46f 100644
index 84f4d772bfe06383ca718b6a00d983e97e2e35f4..3219b9caa654c7a64e5e4a92178528e1104b34c7 100644
--- a/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -454,6 +454,8 @@ public abstract class BlockBehaviour implements FeatureElement {
@@ -451,6 +451,8 @@ public abstract class BlockBehaviour implements FeatureElement {
private VoxelShape[] occlusionShapesByFace;
private boolean propagatesSkylightDown;
private int lightBlock;
@@ -22,7 +22,7 @@ index 7f46f33fa565fa1a3aedce5524f19be8ba420352..d35211b0cae66b1a40e89539507e5597
// Paper start - rewrite chunk system
private boolean isConditionallyFullOpaque;
@@ -603,6 +605,8 @@ public abstract class BlockBehaviour implements FeatureElement {
@@ -600,6 +602,8 @@ public abstract class BlockBehaviour implements FeatureElement {
this.propagatesSkylightDown = this.owner.propagatesSkylightDown(this.asState());
this.lightBlock = this.owner.getLightBlock(this.asState());
@@ -31,7 +31,7 @@ index 7f46f33fa565fa1a3aedce5524f19be8ba420352..d35211b0cae66b1a40e89539507e5597
// Paper start - rewrite chunk system
this.isConditionallyFullOpaque = this.canOcclude & this.useShapeForLightOcclusion;
// Paper end - rewrite chunk system
@@ -654,6 +658,18 @@ public abstract class BlockBehaviour implements FeatureElement {
@@ -651,6 +655,18 @@ public abstract class BlockBehaviour implements FeatureElement {
return block != Blocks.COBWEB && block != Blocks.BAMBOO_SAPLING && this.isSolid();
}
@@ -51,10 +51,10 @@ index 7f46f33fa565fa1a3aedce5524f19be8ba420352..d35211b0cae66b1a40e89539507e5597
public boolean isSolid() {
return this.legacySolid;
diff --git a/net/minecraft/world/level/material/FlowingFluid.java b/net/minecraft/world/level/material/FlowingFluid.java
index 738defb8cbd9c63dc85c479911ebe2f795d0a815..4c2c2efd5380ff1fa5ad7553b51babae20f516ae 100644
index 2a2883b4c38b8ac6e014dab66da0c141f6ac2a64..4625bd55e1cb01dfb9921dcd033f05b4a8f9ad74 100644
--- a/net/minecraft/world/level/material/FlowingFluid.java
+++ b/net/minecraft/world/level/material/FlowingFluid.java
@@ -466,7 +466,7 @@ public abstract class FlowingFluid extends Fluid {
@@ -467,7 +467,7 @@ public abstract class FlowingFluid extends Fluid {
}
private static boolean canHoldFluid(BlockGetter level, BlockPos pos, BlockState state, Fluid fluid) {

View File

@@ -9,15 +9,15 @@ Note: this is different from Paper's skip-tripwire-hook-placement-validation, th
handles tripwire hook dupe
diff --git a/net/minecraft/world/level/block/TripWireHookBlock.java b/net/minecraft/world/level/block/TripWireHookBlock.java
index 9aace993c6c18f1a50610e4766225485984b8167..d62855ce6df9a52cdd8005a43a70353365a92230 100644
index 8a3a8b0fdf9545a41501dc992c6982d9c8ce7b66..af6a189b618c11573cd63e69bcd7ad4467e82fa6 100644
--- a/net/minecraft/world/level/block/TripWireHookBlock.java
+++ b/net/minecraft/world/level/block/TripWireHookBlock.java
@@ -215,7 +215,7 @@ public class TripWireHookBlock extends Block {
@@ -201,7 +201,7 @@ public class TripWireHookBlock extends Block {
BlockState blockState2 = blockStates[i2];
if (blockState2 != null) {
BlockState blockState3 = level.getBlockState(blockPos1);
- if (blockState3.is(Blocks.TRIPWIRE) || blockState3.is(Blocks.TRIPWIRE_HOOK)) {
+ if (org.dreeam.leaf.config.modules.gameplay.ConfigurableTripWireDupe.enabled || blockState3.is(Blocks.TRIPWIRE) || blockState3.is(Blocks.TRIPWIRE_HOOK)) { // Leaf - Configurable tripwire dupe
if (!io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates || !blockState3.is(Blocks.TRIPWIRE)) level.setBlock(blockPos1, blockState2.trySetValue(ATTACHED, Boolean.valueOf(flag2)), 3); // Paper - prevent tripwire from updating
if (!io.papermc.paper.configuration.GlobalConfiguration.get().blockUpdates.disableTripwireUpdates || !blockState3.is(Blocks.TRIPWIRE)) level.setBlock(blockPos1, blockState2.trySetValue(ATTACHED, flag2), 3); // Paper - prevent tripwire from updating
}
}

View File

@@ -12,35 +12,34 @@ We replaced the `blockEntityTickers` list with a custom list based on fastutil's
This is WAY FASTER than using `removeAll` with a list of entries to be removed, because we don't need to calculate the identity of each block entity to be removed, and we can jump directly to where the search should begin, giving a performance boost for small removals (because we don't need to loop thru the entire list to find what element should be removed) and a performance boost for big removals (no need to calculate the identity of each block entity).
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
index 53cabe7dabc83618c8941c95e95c5b7e23ee694e..7d3163802640449b6bdaa93595518d7d0f62488b 100644
index 5fe79a471b5a5f1474a1fcb305b323d2e3a0de87..817cc2e4f311a626681d94b748a01ae2e3048445 100644
--- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java
@@ -113,7 +113,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
@@ -104,7 +104,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
public static final int TICKS_PER_DAY = 24000;
public static final int MAX_ENTITY_SPAWN_Y = 20000000;
public static final int MIN_ENTITY_SPAWN_Y = -20000000;
- public final List<TickingBlockEntity> blockEntityTickers = Lists.newArrayList(); // Paper - public
+ public final org.dreeam.leaf.util.list.BlockEntityTickersList blockEntityTickers = new org.dreeam.leaf.util.list.BlockEntityTickersList(); // Paper - public // SparklyPaper - optimize block entity removals
- public final List<TickingBlockEntity> blockEntityTickers = Lists.newArrayList();
+ public final org.dreeam.leaf.util.list.BlockEntityTickersList blockEntityTickers = new org.dreeam.leaf.util.list.BlockEntityTickersList(); // SparklyPaper - optimize block entity removals
protected final NeighborUpdater neighborUpdater;
private final List<TickingBlockEntity> pendingBlockEntityTickers = Lists.newArrayList();
private boolean tickingBlockEntities;
@@ -1523,14 +1523,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
@@ -1506,13 +1506,11 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
boolean runsNormally = this.tickRateManager().runsNormally();
int tickedEntities = 0; // Paper - rewrite chunk system
- var toRemove = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<TickingBlockEntity>(); // Paper - Fix MC-117075; use removeAll
- toRemove.add(null); // Paper - Fix MC-117075
for (tileTickPosition = 0; tileTickPosition < this.blockEntityTickers.size(); tileTickPosition++) { // Paper - Disable tick limiters
this.tileTickPosition = (this.tileTickPosition < this.blockEntityTickers.size()) ? this.tileTickPosition : 0;
for (this.tileTickPosition = 0; this.tileTickPosition < this.blockEntityTickers.size(); this.tileTickPosition++) { // Paper - Disable tick limiters
TickingBlockEntity tickingBlockEntity = this.blockEntityTickers.get(this.tileTickPosition);
// Spigot end
if (tickingBlockEntity.isRemoved()) {
- toRemove.add(tickingBlockEntity); // Paper - Fix MC-117075; use removeAll
+ this.blockEntityTickers.markAsRemoved(this.tileTickPosition); // toRemove.add(tickingBlockEntity); // SparklyPaper - optimize block entity removals // Paper - Fix MC-117075; use removeAll
+ this.blockEntityTickers.markAsRemoved(this.tileTickPosition); // toRemove.add(tickingBlockEntity); // Paper - Fix MC-117075; use removeAll // SparklyPaper - optimize block entity removals
} else if (runsNormally && this.shouldTickBlocksAt(tickingBlockEntity.getPos())) {
tickingBlockEntity.tick();
// Paper start - rewrite chunk system
@@ -1540,7 +1538,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
@@ -1522,7 +1520,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
// Paper end - rewrite chunk system
}
}

View File

@@ -6,10 +6,10 @@ Subject: [PATCH] SparklyPaper: Skip dirty stats copy when requesting player
diff --git a/net/minecraft/stats/ServerStatsCounter.java b/net/minecraft/stats/ServerStatsCounter.java
index b26dbe807e5cb0a42f6c06b933397902310e5616..ce89060bd01b253af7577fd0e6c03fc95f046b91 100644
index dfaead7716ac718bcdbf4c3021aed1b57676af50..d04de9dc0a9a47e6c17f1000844bdee49e41035f 100644
--- a/net/minecraft/stats/ServerStatsCounter.java
+++ b/net/minecraft/stats/ServerStatsCounter.java
@@ -81,11 +81,15 @@ public class ServerStatsCounter extends StatsCounter {
@@ -100,11 +100,15 @@ public class ServerStatsCounter extends StatsCounter {
this.dirty.add(stat);
}
@@ -25,7 +25,7 @@ index b26dbe807e5cb0a42f6c06b933397902310e5616..ce89060bd01b253af7577fd0e6c03fc9
public void parseLocal(DataFixer fixerUpper, String json) {
try {
@@ -194,10 +198,12 @@ public class ServerStatsCounter extends StatsCounter {
@@ -146,10 +150,12 @@ public class ServerStatsCounter extends StatsCounter {
public void sendStats(ServerPlayer player) {
Object2IntMap<Stat<?>> map = new Object2IntOpenHashMap<>();

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Optimize checking nearby players for spawning
diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java
index 8986c059e7aadb58ae8d9ab7b848de10f9faa6b2..546b20f8998c71ca1a701de7efcedd8d821105e4 100644
index 560a857f3b61679bbf2ee93ac6da393052a1f320..a50fb16dc2e6230d346eea8ee76820ec56906446 100644
--- a/net/minecraft/server/level/ChunkMap.java
+++ b/net/minecraft/server/level/ChunkMap.java
@@ -719,7 +719,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -773,7 +773,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
private boolean anyPlayerCloseEnoughForSpawningInternal(ChunkPos chunkPos, boolean reducedRange) {
@@ -17,7 +17,7 @@ index 8986c059e7aadb58ae8d9ab7b848de10f9faa6b2..546b20f8998c71ca1a701de7efcedd8d
// Spigot end
// Paper start - chunk tick iteration optimisation
final ca.spottedleaf.moonrise.common.list.ReferenceList<ServerPlayer> players = ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)this.level).moonrise$getNearbyPlayers().getPlayers(
@@ -731,23 +731,39 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -785,23 +785,35 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
final ServerPlayer[] raw = players.getRawDataUnchecked();
final int len = players.size();
@@ -33,11 +33,8 @@ index 8986c059e7aadb58ae8d9ab7b848de10f9faa6b2..546b20f8998c71ca1a701de7efcedd8d
- // Paper start - PlayerNaturallySpawnCreaturesEvent
- com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent event;
- blockRange = 16384.0D;
+
+ if (serverPlayer.isSpectator()) continue; // Skip spectators early
+
+ final double blockRangeSquared;
+
if (reducedRange) {
- event = serverPlayer.playerNaturallySpawnedEvent;
+ // Handle reduced range from PlayerNaturallySpawnCreaturesEvent
@@ -45,15 +42,14 @@ index 8986c059e7aadb58ae8d9ab7b848de10f9faa6b2..546b20f8998c71ca1a701de7efcedd8d
+ final com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent event = serverPlayer.playerNaturallySpawnedEvent;
if (event == null || event.isCancelled()) continue;
- blockRange = (double) ((event.getSpawnRadius() << 4) * (event.getSpawnRadius() << 4));
- }
- if (this.playerIsCloseEnoughForSpawning(serverPlayer, chunkPos, blockRange)) {
+ final int spawnRadius = event.getSpawnRadius();
+ blockRangeSquared = (double) (spawnRadius * spawnRadius) * 256.0; // (radius << 4)^2
+ // Paper end - PlayerNaturallySpawnCreaturesEvent
// Paper end - PlayerNaturallySpawnCreaturesEvent
+ } else {
+ blockRangeSquared = 16384.0D; // Default 128^2
}
- // Paper end - PlayerNaturallySpawnCreaturesEvent
- if (this.playerIsCloseEnoughForSpawning(serverPlayer, chunkPos, blockRange)) {
+
+ }
+ // Calculate squared distance using precomputed center
+ final double dx = serverPlayer.getX() - centerX;
+ final double dz = serverPlayer.getZ() - centerZ;

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Cache supporting block check
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 4544dd876d3cbcdb9b774b4a1f0c4737f3124bc5..6ca446fd9ab38329ba505526a56f8e4f64a9a639 100644
index a2e9306d9a5eef738f8225e98fb1cc1f4bbca504..cb17aaad72940ac94317a50cbe85b22c00e02a10 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -1083,12 +1083,36 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -1078,12 +1078,36 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return this.mainSupportingBlockPos.isPresent() && this.mainSupportingBlockPos.get().equals(pos);
}
@@ -45,7 +45,7 @@ index 4544dd876d3cbcdb9b774b4a1f0c4737f3124bc5..6ca446fd9ab38329ba505526a56f8e4f
this.mainSupportingBlockPos = optional;
} else if (movement != null) {
AABB aabb1 = aabb.move(-movement.x, 0.0, -movement.z);
@@ -1105,6 +1129,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -1100,6 +1124,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
}

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Replace brain activity maps with optimized collection
diff --git a/net/minecraft/world/entity/ai/Brain.java b/net/minecraft/world/entity/ai/Brain.java
index ea6c8e85ccff67b1c24109732f74f1e8199cad07..e27284f9897923f67985e3d60c3438bd00cc4a51 100644
index b2e17d387558875f45a8458cf874a5b056820432..e78cef4c0ee6cff7ec2f27ced12c96be67dc7a0e 100644
--- a/net/minecraft/world/entity/ai/Brain.java
+++ b/net/minecraft/world/entity/ai/Brain.java
@@ -390,8 +390,8 @@ public class Brain<E extends LivingEntity> {
@@ -399,8 +399,8 @@ public class Brain<E extends LivingEntity> {
for (Pair<Integer, ? extends BehaviorControl<? super E>> pair : tasks) {
this.availableBehaviorsByPriority

View File

@@ -14,19 +14,19 @@ under 2048 villagers situation.
And ~93.92% improvement (~1382ms -> ~84ms), under 512 villagers situation.
diff --git a/net/minecraft/world/entity/ai/behavior/TradeWithVillager.java b/net/minecraft/world/entity/ai/behavior/TradeWithVillager.java
index 4d8523a43d60cd6b4fd5546ffb3a61417b2c475b..8921faa7b893aae9e91a6f8e36dcd751308f9bab 100644
index 72cca4897f9697573fd6987a5f0d2df52761b8c3..04eea77cf84aaeb781608e48f2aa32f344689889 100644
--- a/net/minecraft/world/entity/ai/behavior/TradeWithVillager.java
+++ b/net/minecraft/world/entity/ai/behavior/TradeWithVillager.java
@@ -77,9 +77,19 @@ public class TradeWithVillager extends Behavior<Villager> {
}
private static Set<Item> figureOutWhatIAmWillingToTrade(Villager villager, Villager other) {
- ImmutableSet<Item> set = other.getVillagerData().getProfession().requestedItems();
- ImmutableSet<Item> set1 = villager.getVillagerData().getProfession().requestedItems();
- ImmutableSet<Item> set = other.getVillagerData().profession().value().requestedItems();
- ImmutableSet<Item> set1 = villager.getVillagerData().profession().value().requestedItems();
- return set.stream().filter(item -> !set1.contains(item)).collect(Collectors.toSet());
+ // Leaf start - Remove stream in villagers
+ ImmutableSet<Item> otherItems = other.getVillagerData().getProfession().requestedItems();
+ ImmutableSet<Item> villagerItems = villager.getVillagerData().getProfession().requestedItems();
+ ImmutableSet<Item> otherItems = other.getVillagerData().profession().value().requestedItems();
+ ImmutableSet<Item> villagerItems = villager.getVillagerData().profession().value().requestedItems();
+ Set<Item> result = new java.util.HashSet<>();
+
+ for (Item item : otherItems) {
@@ -41,10 +41,10 @@ index 4d8523a43d60cd6b4fd5546ffb3a61417b2c475b..8921faa7b893aae9e91a6f8e36dcd751
private static void throwHalfStack(Villager villager, Set<Item> stack, LivingEntity entity) {
diff --git a/net/minecraft/world/entity/npc/Villager.java b/net/minecraft/world/entity/npc/Villager.java
index bee017f2c47a9f0876e2e05ce1c720332fb74566..0b4c4707139c9c72929799818ec1a1b25575d70e 100644
index 48384d7a9cb41506e0b5024baf806e56497e9d62..ffc46d3ffe6d3a577fbad381f1f7d82d78e33d2a 100644
--- a/net/minecraft/world/entity/npc/Villager.java
+++ b/net/minecraft/world/entity/npc/Villager.java
@@ -985,7 +985,17 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
@@ -972,7 +972,17 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
private int countFoodPointsInInventory() {
SimpleContainer inventory = this.getInventory();

View File

@@ -6,10 +6,10 @@ Subject: [PATCH] Only player pushable
Useful for extreme cases like massive entities collide together in a small area
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index 00233a7066d751821566b43993e8c45e7dad95d0..03c9edad5c2f5e902b7a766c6d0be61bf3c263ae 100644
index eb40f810d4eb8d6a8cc130719b637a473f19cc82..9d6d8ba96acd688d07bfecc29ff9de95abcd839c 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -3631,7 +3631,7 @@ public abstract class LivingEntity extends Entity implements Attackable, net.caf
@@ -3630,7 +3630,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.checkAutoSpinAttack(boundingBox, this.getBoundingBox());
}
@@ -18,23 +18,21 @@ index 00233a7066d751821566b43993e8c45e7dad95d0..03c9edad5c2f5e902b7a766c6d0be61b
// Paper start - Add EntityMoveEvent
// Purpur start - Ridables
if (this.xo != this.getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) {
@@ -3769,7 +3769,14 @@ public abstract class LivingEntity extends Entity implements Attackable, net.caf
return;
}
// Paper end - don't run getEntities if we're not going to use its result
- List<Entity> entities = this.level().getEntities(this, this.getBoundingBox(), EntitySelector.pushable(this, this.level().paperConfig().collisions.fixClimbingBypassingCrammingRule)); // Paper - Climbing should not bypass cramming gamerule
+ // Leaf start - Only player pushable
+ final AABB box = this.getBoundingBox();
+ final Predicate<Entity> conditions = EntitySelector.pushable(this, this.level().paperConfig().collisions.fixClimbingBypassingCrammingRule);
+
+ List<Entity> entities = org.dreeam.leaf.config.modules.gameplay.OnlyPlayerPushable.enabled
+ ? getNearbyPushablePlayers(this, box, conditions)
+ : this.level().getEntities(this, box, conditions); // Paper - Climbing should not bypass cramming gamerule
+ // Leaf end - Only player pushable
if (!entities.isEmpty()) {
@@ -3773,7 +3773,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
return;
}
// Paper end - don't run getEntities if we're not going to use its result
- List<Entity> pushableEntities = this.level().getPushableEntities(this, this.getBoundingBox());
+ // Leaf start - Only player pushable
+ final AABB box = this.getBoundingBox();
+ List<Entity> pushableEntities = org.dreeam.leaf.config.modules.gameplay.OnlyPlayerPushable.enabled
+ ? getNearbyPushablePlayers(this, box, EntitySelector.pushableBy(this))
+ : this.level().getPushableEntities(this, box);
+ // Leaf end - Only player pushable
if (!pushableEntities.isEmpty()) {
if (this.level() instanceof ServerLevel serverLevel) {
// Paper - don't run getEntities if we're not going to use its result; moved up
if (_int > 0 && entities.size() > _int - 1 && this.random.nextInt(4) == 0) {
@@ -3802,6 +3809,44 @@ public abstract class LivingEntity extends Entity implements Attackable, net.caf
@@ -3807,6 +3812,44 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
}
@@ -50,7 +48,7 @@ index 00233a7066d751821566b43993e8c45e7dad95d0..03c9edad5c2f5e902b7a766c6d0be61b
+ );
+
+ if (players == null) {
+ return new ArrayList<>();
+ return new java.util.ArrayList<>();
+ }
+
+ List<Entity> ret = null;
@@ -64,7 +62,7 @@ index 00233a7066d751821566b43993e8c45e7dad95d0..03c9edad5c2f5e902b7a766c6d0be61b
+ final ServerPlayer player = raw[i];
+ if (player != entity && box.intersects(player.getBoundingBox()) && conditions.test(player)) {
+ if (ret == null) {
+ ret = new ArrayList<>(len - i);
+ ret = new java.util.ArrayList<>(len - i);
+ ret.add(player);
+ } else {
+ ret.add(player);
@@ -72,7 +70,7 @@ index 00233a7066d751821566b43993e8c45e7dad95d0..03c9edad5c2f5e902b7a766c6d0be61b
+ }
+ }
+
+ return ret == null ? new ArrayList<>() : ret;
+ return ret == null ? new java.util.ArrayList<>() : ret;
+ }
+ // Leaf end - Only player pushable
+
@@ -80,10 +78,10 @@ index 00233a7066d751821566b43993e8c45e7dad95d0..03c9edad5c2f5e902b7a766c6d0be61b
AABB aabb = boundingBoxBeforeSpin.minmax(boundingBoxAfterSpin);
List<Entity> entities = this.level().getEntities(this, aabb);
diff --git a/net/minecraft/world/entity/decoration/ArmorStand.java b/net/minecraft/world/entity/decoration/ArmorStand.java
index 21153f37c169e987d7876d1b914105223ac10ee7..a8bd9f027b5ce360b9e720a7734451bcf9f701d4 100644
index 49500127eb3a471c41dc3ff32372ad6f20c6d69a..aee9711b76c76e64056b73f8581cce0ba40b0811 100644
--- a/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -326,7 +326,7 @@ public class ArmorStand extends LivingEntity implements net.caffeinemc.mods.lith
@@ -247,7 +247,7 @@ public class ArmorStand extends LivingEntity {
@Override
protected void pushEntities() {

View File

@@ -0,0 +1,131 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Taiyou06 <kaandindar21@gmail.com>
Date: Thu, 13 Feb 2025 01:25:40 +0100
Subject: [PATCH] Remove iterators from Inventory
diff --git a/net/minecraft/world/entity/player/Inventory.java b/net/minecraft/world/entity/player/Inventory.java
index dd406c5becacbc2d05b062726a8af88a1d6faba9..4b46bc712e20bd5f841d2d7caaad52068969bdc1 100644
--- a/net/minecraft/world/entity/player/Inventory.java
+++ b/net/minecraft/world/entity/player/Inventory.java
@@ -435,13 +435,16 @@ public class Inventory implements Container, Nameable {
}
}
- for (EquipmentSlot equipmentSlot : EQUIPMENT_SLOT_MAPPING.values()) {
+ // Leaf start - Remove iterators from Inventory
+ for (int i = 0; i < EQUIPMENT_SLOT_MAPPING.size(); i++) {
+ EquipmentSlot equipmentSlot = EQUIPMENT_SLOT_MAPPING.get(i);
ItemStack itemStack = this.equipment.get(equipmentSlot);
if (itemStack == stack) {
this.equipment.set(equipmentSlot, ItemStack.EMPTY);
return;
}
}
+ // Leaf end - Remove iterators from Inventory
}
@Override
@@ -500,17 +503,21 @@ public class Inventory implements Container, Nameable {
@Override
public boolean isEmpty() {
- for (ItemStack itemStack : this.items) {
+ // Leaf start - Remove iterators from Inventory
+ for (int i = 0; i < this.items.size(); i++) {
+ ItemStack itemStack = this.items.get(i);
if (!itemStack.isEmpty()) {
return false;
}
}
- for (EquipmentSlot equipmentSlot : EQUIPMENT_SLOT_MAPPING.values()) {
+ for (int i = 0; i < EQUIPMENT_SLOT_MAPPING.size(); i++) {
+ EquipmentSlot equipmentSlot = EQUIPMENT_SLOT_MAPPING.get(i);
if (!this.equipment.get(equipmentSlot).isEmpty()) {
return false;
}
}
+ // Leaf end - Remove iterators from Inventory
return true;
}
@@ -557,31 +564,61 @@ public class Inventory implements Container, Nameable {
}
public boolean contains(ItemStack stack) {
- for (ItemStack itemStack : this) {
+ // Leaf start - Remove iterators from Inventory
+ for (int i = 0; i < this.items.size(); i++) {
+ ItemStack itemStack = this.items.get(i);
if (!itemStack.isEmpty() && ItemStack.isSameItemSameComponents(itemStack, stack)) {
return true;
}
}
+ for (int i = 0; i < EQUIPMENT_SLOT_MAPPING.size(); i++) {
+ EquipmentSlot equipmentSlot = EQUIPMENT_SLOT_MAPPING.get(i);
+ ItemStack itemStack = this.equipment.get(equipmentSlot);
+ if (!itemStack.isEmpty() && ItemStack.isSameItemSameComponents(itemStack, stack)) {
+ return true;
+ }
+ }
+ // Leaf end - Remove iterators from Inventory
return false;
}
public boolean contains(TagKey<Item> tag) {
- for (ItemStack itemStack : this) {
+ // Leaf start - Remove iterators from Inventory
+ for (int i = 0; i < this.items.size(); i++) {
+ ItemStack itemStack = this.items.get(i);
if (!itemStack.isEmpty() && itemStack.is(tag)) {
return true;
}
}
+ for (int i = 0; i < EQUIPMENT_SLOT_MAPPING.size(); i++) {
+ EquipmentSlot equipmentSlot = EQUIPMENT_SLOT_MAPPING.get(i);
+ ItemStack itemStack = this.equipment.get(equipmentSlot);
+ if (!itemStack.isEmpty() && itemStack.is(tag)) {
+ return true;
+ }
+ }
+ // Leaf end - Remove iterators from Inventory
return false;
}
public boolean contains(Predicate<ItemStack> predicate) {
- for (ItemStack itemStack : this) {
+ // Leaf start - Remove iterators from Inventory
+ for (int i = 0; i < this.items.size(); i++) {
+ ItemStack itemStack = this.items.get(i);
+ if (predicate.test(itemStack)) {
+ return true;
+ }
+ }
+ for (int i = 0; i < EQUIPMENT_SLOT_MAPPING.size(); i++) {
+ EquipmentSlot equipmentSlot = EQUIPMENT_SLOT_MAPPING.get(i);
+ ItemStack itemStack = this.equipment.get(equipmentSlot);
if (predicate.test(itemStack)) {
return true;
}
}
+ // Leaf end - Remove iterators from Inventory
return false;
}
@@ -601,9 +638,12 @@ public class Inventory implements Container, Nameable {
}
public void fillStackedContents(StackedItemContents contents) {
- for (ItemStack itemStack : this.items) {
+ // Leaf start - Remove iterators from Inventory
+ for (int i = 0; i < this.items.size(); i++) {
+ ItemStack itemStack = this.items.get(i);
contents.accountSimpleStack(itemStack);
}
+ // Leaf end - Remove iterators from Inventory
}
public ItemStack removeFromSelected(boolean removeStack) {

View File

@@ -7,7 +7,7 @@ In the test, this can give ~54.87% improvement (~25712ms -> ~11604ms),
under 1024 villagers situation.
diff --git a/net/minecraft/world/entity/ai/Brain.java b/net/minecraft/world/entity/ai/Brain.java
index e27284f9897923f67985e3d60c3438bd00cc4a51..0ff7564e0e848bd38e82f9089bfd7249fa649dc5 100644
index e78cef4c0ee6cff7ec2f27ced12c96be67dc7a0e..e3d0186e681168840836690acd402b774bc464b5 100644
--- a/net/minecraft/world/entity/ai/Brain.java
+++ b/net/minecraft/world/entity/ai/Brain.java
@@ -268,23 +268,52 @@ public class Brain<E extends LivingEntity> {

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Cache eligible players for despawn checks
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index 20ded514a74652685b2f785c7fe5fda19e36b2a5..5da07e22ef9dac7baca9d8450b7eae3f6fa141b1 100644
index b9bff011c0ffb0efdaccc65847be69aad1a70681..d8390cb3901a40b97e99990d9f71f12c74f96607 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -735,6 +735,8 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -723,6 +723,8 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
return this.structureManager;
}
@@ -17,7 +17,7 @@ index 20ded514a74652685b2f785c7fe5fda19e36b2a5..5da07e22ef9dac7baca9d8450b7eae3f
public void tick(BooleanSupplier hasTimeLeft) {
this.handlingTick = true;
TickRateManager tickRateManager = this.tickRateManager();
@@ -802,6 +804,19 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -790,6 +792,19 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
io.papermc.paper.entity.activation.ActivationRange.activateEntities(this); // Paper - EAR
@@ -38,10 +38,10 @@ index 20ded514a74652685b2f785c7fe5fda19e36b2a5..5da07e22ef9dac7baca9d8450b7eae3f
.forEach(
entity -> {
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index 336215befa7eb4b20fc86f224a019080cea70113..e2b15968e89a532ec21c786f41b7f9322fd65a04 100644
index 2ad0c935e16b92007475c681641770aa27f2b0c3..f9c247769e71afe7cb7ccb9680dfe34df706e7cd 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -1576,6 +1576,13 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -1518,6 +1518,13 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
this.containerMenu.broadcastChanges();
}
@@ -56,10 +56,10 @@ index 336215befa7eb4b20fc86f224a019080cea70113..e2b15968e89a532ec21c786f41b7f932
private Either<Player.BedSleepingProblem, Unit> getBedResult(BlockPos at, Direction direction) {
if (this.isSleeping() || !this.isAlive()) {
diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java
index 54eeb0b112112bc5d3f4165c0ea43cf67931a739..05d5cde42b7011091ef4ee874c0d9d5586ae3f10 100644
index d473c09e98eb5d3ef7b3e096197c7bf9a6219c56..77075bf43e7e2301e58aa6d9f8bfe934cce42f55 100644
--- a/net/minecraft/world/entity/Mob.java
+++ b/net/minecraft/world/entity/Mob.java
@@ -854,7 +854,24 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
@@ -705,7 +705,24 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
if (this.level().getDifficulty() == Difficulty.PEACEFUL && this.shouldDespawnInPeaceful()) {
this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
} else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) {

View File

@@ -5,20 +5,19 @@ Subject: [PATCH] Use ensureCapacity to pre-populate the size of ticking chunks
list output
diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java
index 6735f9e23c8972b7cf1438a2f3b49d780c1ff78c..c80464d333bd37a9b8bc7cea2291c8c72e6f9bd6 100644
--- a/net/minecraft/server/level/ServerChunkCache.java
+++ b/net/minecraft/server/level/ServerChunkCache.java
@@ -585,7 +585,11 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
final ServerChunkCache.ChunkAndHolder[] raw = tickingChunks.getRawDataUnchecked();
diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java
index a50fb16dc2e6230d346eea8ee76820ec56906446..4a2ef88cb75f4a10565ed819570b2885942b525c 100644
--- a/net/minecraft/server/level/ChunkMap.java
+++ b/net/minecraft/server/level/ChunkMap.java
@@ -733,6 +733,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
final int size = tickingChunks.size();
- final ChunkMap chunkMap = this.chunkMap;
Objects.checkFromToIndex(0, size, raw.length);
+ // Leaf start - Use ensureCapacity to pre-populate the size of ticking chunks list output
+ if (output instanceof ArrayList<LevelChunk> arrayList) {
+ arrayList.ensureCapacity(size);
+ }
+ // Leaf end - Use ensureCapacity to pre-populate the size of ticking chunks list output
for (int i = 0; i < size; ++i) {
final ServerChunkCache.ChunkAndHolder chunkAndHolder = raw[i];
final LevelChunk levelChunk = raw[i];

View File

@@ -0,0 +1,27 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Taiyou06 <kaandindar21@gmail.com>
Date: Sun, 16 Feb 2025 01:13:04 +0100
Subject: [PATCH] Directly use the pre-filtered ticking chunks list as the
output
This patch uses already pre filtered chunks, which completely skips the isChunkNearPlayer check
diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java
index 4a2ef88cb75f4a10565ed819570b2885942b525c..b94375fb83fab6434060c2f7288dc7a366ed1391 100644
--- a/net/minecraft/server/level/ChunkMap.java
+++ b/net/minecraft/server/level/ChunkMap.java
@@ -739,13 +739,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
// Leaf end - Use ensureCapacity to pre-populate the size of ticking chunks list output
for (int i = 0; i < size; ++i) {
- final LevelChunk levelChunk = raw[i];
-
- if (!this.isChunkNearPlayer((ChunkMap)(Object)this, levelChunk.getPos(), levelChunk)) {
- continue;
- }
-
- output.add(levelChunk);
+ output.add(raw[i]); // Leaf - Directly use the pre-filtered ticking chunks list as the output
}
}