9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2026-01-04 15:41:40 +00:00

Format patch & get fluidstate from blockstate, instead of from level

This commit is contained in:
Dreeam
2025-07-09 06:41:16 +08:00
parent 87c17a40cc
commit a9c10502d5
9 changed files with 40 additions and 38 deletions

View File

@@ -13,23 +13,25 @@ As part of: MultiPaper (https://github.com/MultiPaper/MultiPaper)
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
diff --git a/net/minecraft/world/level/levelgen/PhantomSpawner.java b/net/minecraft/world/level/levelgen/PhantomSpawner.java
index d2e674b046bcf82a239b4706c3b89197ec6749c8..1ec7abf2c82a5371fe1dacd57d90386fdae67f56 100644
index d2e674b046bcf82a239b4706c3b89197ec6749c8..07231d39357b4a58a22a17d6e965c4d611aff6a6 100644
--- a/net/minecraft/world/level/levelgen/PhantomSpawner.java
+++ b/net/minecraft/world/level/levelgen/PhantomSpawner.java
@@ -52,7 +52,15 @@ public class PhantomSpawner implements CustomSpawner {
@@ -52,8 +52,16 @@ public class PhantomSpawner implements CustomSpawner {
BlockPos blockPos1 = blockPos.above(20 + randomSource.nextInt(15))
.east(-10 + randomSource.nextInt(21))
.south(-10 + randomSource.nextInt(21));
- BlockState blockState = level.getBlockState(blockPos1);
+ // Gale start - MultiPaper - don't load chunks to spawn phantoms
+ BlockState blockState;
+ if (level.galeConfig().smallOptimizations.loadChunks.toSpawnPhantoms) {
+ blockState = level.getBlockState(blockPos1);
+ } else {
+ blockState = level.getBlockStateIfLoaded(blockPos1);
+ if (blockState == null) continue;
+ }
+ // Gale end - MultiPaper - don't load chunks to spawn phantoms
FluidState fluidState = level.getFluidState(blockPos1);
- FluidState fluidState = level.getFluidState(blockPos1);
+ // Gale start - MultiPaper - don't load chunks to spawn phantoms
+ BlockState blockState;
+ if (level.galeConfig().smallOptimizations.loadChunks.toSpawnPhantoms) {
+ blockState = level.getBlockState(blockPos1);
+ } else {
+ blockState = level.getBlockStateIfLoaded(blockPos1);
+ if (blockState == null) continue;
+ }
+ FluidState fluidState = blockState.getFluidState();
+ // Gale end - MultiPaper - don't load chunks to spawn phantoms
if (NaturalSpawner.isValidEmptySpawnBlock(level, blockPos1, blockState, fluidState, EntityType.PHANTOM)) {
SpawnGroupData spawnGroupData = null;
int i2 = 1 + randomSource.nextInt(currentDifficultyAt.getDifficulty().getId() + 1);

View File

@@ -28,7 +28,7 @@ index 8fcc1223942114f46c36028326e9c7daf4f0d9e0..41279a276622062338bef685491cc295
return this.chunkPosition;
}
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index 586b79bc844b098336c6d3bf342b570396e6af88..bc284bbd3d601b1e7c15f663cb65b85c24d85a41 100644
index 586b79bc844b098336c6d3bf342b570396e6af88..9e93c446fb3641a88643d382abddc5d2acc8a810 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -2129,8 +2129,17 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -51,7 +51,7 @@ index 586b79bc844b098336c6d3bf342b570396e6af88..bc284bbd3d601b1e7c15f663cb65b85c
}
return this.cachedOnClimbable;
@@ -2138,11 +2147,28 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -2138,11 +2147,25 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
// Gale end - Airplane - cache on climbable check
public boolean onClimbable() {
@@ -72,10 +72,7 @@ index 586b79bc844b098336c6d3bf342b570396e6af88..bc284bbd3d601b1e7c15f663cb65b85c
+ inBlockState = this.getInBlockState();
+ } else {
+ inBlockState = this.getInBlockStateIfLoaded();
+
+ if (inBlockState == null) {
+ return null;
+ }
+ if (inBlockState == null) return null;
+ }
+ // Gale end - don't load chunks to activate climbing entities
if (inBlockState.is(BlockTags.CLIMBABLE)) {

View File

@@ -2310,7 +2310,7 @@ index aab9adb8313c4b18279c7fd7500ef04bda09c6c1..86a694b94045b47f6e98c480645f7573
protected ParticleOptions getInkParticle() {
return ParticleTypes.GLOW_SQUID_INK;
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index fd775ce9a6ca84ce348d929f75f019581a437ea4..dd5343287503e2818e083696a17362091d94e652 100644
index 40b9dd1a1568f0f1eeba6925167a79cde48d66fd..25a7651efa80938124bbda27a1de25e9a6eb3620 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -236,9 +236,9 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -2529,7 +2529,7 @@ index fd775ce9a6ca84ce348d929f75f019581a437ea4..dd5343287503e2818e083696a1736209
}
// CraftBukkit start - Call death event // Paper start - call advancement triggers with correct entity equipment
@@ -3013,6 +3074,21 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -3010,6 +3071,21 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
this.move(MoverType.SELF, this.getDeltaMovement());
this.setDeltaMovement(this.getDeltaMovement().scale(0.5));
} else {
@@ -2551,7 +2551,7 @@ index fd775ce9a6ca84ce348d929f75f019581a437ea4..dd5343287503e2818e083696a1736209
this.moveRelative(amount, relative);
this.move(MoverType.SELF, this.getDeltaMovement());
this.setDeltaMovement(this.getDeltaMovement().scale(0.91F));
@@ -3153,6 +3229,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -3150,6 +3226,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
float f = (float)(d * 10.0 - 3.0);
if (f > 0.0F) {
this.playSound(this.getFallDamageSound((int)f), 1.0F, 1.0F);
@@ -2559,7 +2559,7 @@ index fd775ce9a6ca84ce348d929f75f019581a437ea4..dd5343287503e2818e083696a1736209
this.hurt(this.damageSources().flyIntoWall(), f);
}
}
@@ -3596,8 +3673,10 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -3593,8 +3670,10 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
this.pushEntities();
// Paper start - Add EntityMoveEvent
@@ -2572,7 +2572,7 @@ index fd775ce9a6ca84ce348d929f75f019581a437ea4..dd5343287503e2818e083696a1736209
Location from = new Location(this.level().getWorld(), this.xo, this.yo, this.zo, this.yRotO, this.xRotO);
Location to = new Location(this.level().getWorld(), this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
io.papermc.paper.event.entity.EntityMoveEvent event = new io.papermc.paper.event.entity.EntityMoveEvent(this.getBukkitLivingEntity(), from, to.clone());
@@ -3607,11 +3686,52 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -3604,11 +3683,52 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
this.absSnapTo(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ(), event.getTo().getYaw(), event.getTo().getPitch());
}
}
@@ -2625,7 +2625,7 @@ index fd775ce9a6ca84ce348d929f75f019581a437ea4..dd5343287503e2818e083696a1736209
}
protected void applyInput() {
@@ -3645,7 +3765,18 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -3642,7 +3762,18 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
.filter(equipmentSlot1 -> canGlideUsing(this.getItemBySlot(equipmentSlot1), equipmentSlot1))
.toList();
EquipmentSlot equipmentSlot = Util.getRandom(list, this.random);
@@ -2645,7 +2645,7 @@ index fd775ce9a6ca84ce348d929f75f019581a437ea4..dd5343287503e2818e083696a1736209
}
this.gameEvent(GameEvent.ELYTRA_GLIDE);
@@ -4533,6 +4664,12 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -4530,6 +4661,12 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
: slot == equippable.slot() && this.canUseSlot(equippable.slot()) && equippable.canBeEquippedBy(this.getType());
}
@@ -16693,7 +16693,7 @@ index 04527a5c65ad630f794fed9071d485aedd02257a..77731406cb3dc417aa2fe1cb4352f3d2
NoiseCache cache = noiseCache.get().computeIfAbsent(noise, noiseKey -> new NoiseCache()); // Paper - Perf: Optimize end generation
diff --git a/net/minecraft/world/level/levelgen/PhantomSpawner.java b/net/minecraft/world/level/levelgen/PhantomSpawner.java
index 1ec7abf2c82a5371fe1dacd57d90386fdae67f56..d9fca70ff61f20401643fe95833d3f7fbf3117e0 100644
index 07231d39357b4a58a22a17d6e965c4d611aff6a6..2b869b00b9512f7705b82062742635cc348c01aa 100644
--- a/net/minecraft/world/level/levelgen/PhantomSpawner.java
+++ b/net/minecraft/world/level/levelgen/PhantomSpawner.java
@@ -38,13 +38,13 @@ public class PhantomSpawner implements CustomSpawner {
@@ -16714,7 +16714,7 @@ index 1ec7abf2c82a5371fe1dacd57d90386fdae67f56..d9fca70ff61f20401643fe95833d3f7f
int i = Mth.clamp(stats.getValue(Stats.CUSTOM.get(Stats.TIME_SINCE_REST)), 1, Integer.MAX_VALUE);
int i1 = 24000;
@@ -64,7 +64,7 @@ public class PhantomSpawner implements CustomSpawner {
FluidState fluidState = level.getFluidState(blockPos1);
// Gale end - MultiPaper - don't load chunks to spawn phantoms
if (NaturalSpawner.isValidEmptySpawnBlock(level, blockPos1, blockState, fluidState, EntityType.PHANTOM)) {
SpawnGroupData spawnGroupData = null;
- int i2 = 1 + randomSource.nextInt(currentDifficultyAt.getDifficulty().getId() + 1);

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 78c212fb8a8a8ffefe6fc860f1e06d16ba09bb40..ca167a295f15ccde2d02cf83fe83aa445483a10b 100644
index 7f7304af9bcf252af2e171bf64ebb139f6d30d86..875975594bc1356c416f6824907037aa28d2993d 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -2828,6 +2828,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -2825,6 +2825,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
}
protected void updateSwingTime() {
@@ -23,7 +23,7 @@ index 78c212fb8a8a8ffefe6fc860f1e06d16ba09bb40..ca167a295f15ccde2d02cf83fe83aa44
int currentSwingDuration = this.getCurrentSwingDuration();
if (this.swinging) {
this.swingTime++;
@@ -3775,6 +3776,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -3772,6 +3773,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
protected void updateFallFlying() {
this.checkFallDistanceAccumulation();
if (!this.level().isClientSide) {

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 ca167a295f15ccde2d02cf83fe83aa445483a10b..1d78cacbf2c63f35fdf0552d50834385ab51aaf0 100644
index 875975594bc1356c416f6824907037aa28d2993d..3df99f699db7f25d3e05e2626c4babee87893813 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -3697,7 +3697,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -3694,7 +3694,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
this.checkAutoSpinAttack(boundingBox, this.getBoundingBox());
}
@@ -18,7 +18,7 @@ index ca167a295f15ccde2d02cf83fe83aa445483a10b..1d78cacbf2c63f35fdf0552d50834385
// 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()) {
@@ -3844,7 +3844,12 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -3841,7 +3841,12 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
return;
}
// Paper end - don't run getEntities if we're not going to use its result
@@ -32,7 +32,7 @@ index ca167a295f15ccde2d02cf83fe83aa445483a10b..1d78cacbf2c63f35fdf0552d50834385
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
@@ -3878,6 +3883,44 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -3875,6 +3880,44 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
}
}

View File

@@ -18,10 +18,10 @@ index 4a39b4ee1ea860a8a47bdad67ac79c74157b6d07..9ec5f1ebc013b427e92f92d6df722b42
}
}
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index aadba595ca9ad6ba403b16b3c741421005f0414a..93c1e8f39f8db3cd69959f1528ef80481f74e8b0 100644
index 0ebc6dcb8d76de33dfae2f17e580df2364580359..762dc374d77f615f2a2a4fff9158a9de41d8ab17 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -4160,9 +4160,9 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -4157,9 +4157,9 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
}
if (randomizeMotion) {

View File

@@ -6,10 +6,10 @@ Subject: [PATCH] Fix Paper config fixClimbingBypassingCrammingRule
Waiting for Paper#12793
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index f18843e7a13ed5d98086e65e896aa98e5f6af281..6227791579f66a11fd20748bb822c6e477ad9197 100644
index 3a669d98db60bfe19aa0c4b55dc28d06d44f7b88..fdb6527c9d7e18c37e681ea2d8e4428ece49e2ff 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -3853,7 +3853,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
@@ -3850,7 +3850,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
// Leaf start - Only player pushable
final AABB box = this.getBoundingBox();
List<Entity> pushableEntities = org.dreeam.leaf.config.modules.gameplay.OnlyPlayerPushable.enabled