Tidy patches

This commit is contained in:
MrHua269
2025-05-01 09:17:50 +08:00
parent 45ce5b56bd
commit 80e438bf96
42 changed files with 23 additions and 16 deletions

View File

@@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Helvetica Volubi <suisuroru@blue-millennium.fun> From: Helvetica Volubi <suisuroru@blue-millennium.fun>
Date: Sun, 13 Apr 2025 11:07:04 +0800 Date: Sun, 13 Apr 2025 11:07:04 +0800
Subject: [PATCH] Disable Heightmap Warning Subject: [PATCH] Add config to disable heightmap warning
diff --git a/net/minecraft/world/level/levelgen/Heightmap.java b/net/minecraft/world/level/levelgen/Heightmap.java diff --git a/net/minecraft/world/level/levelgen/Heightmap.java b/net/minecraft/world/level/levelgen/Heightmap.java

View File

@@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Helvetica Volubi <suisuroru@blue-millennium.fun> From: Helvetica Volubi <suisuroru@blue-millennium.fun>
Date: Fri, 11 Apr 2025 16:53:57 +0800 Date: Fri, 11 Apr 2025 16:53:57 +0800
Subject: [PATCH] Revert raid changes Subject: [PATCH] Add config to revert raid changes
diff --git a/net/minecraft/world/effect/BadOmenMobEffect.java b/net/minecraft/world/effect/BadOmenMobEffect.java diff --git a/net/minecraft/world/effect/BadOmenMobEffect.java b/net/minecraft/world/effect/BadOmenMobEffect.java

View File

@@ -5,18 +5,20 @@ Subject: [PATCH] Fix off tickregion sync teleport
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index ceca76a5791e319dd7cc4048c9860b1df065b95a..fc7da66320bfd8701b754e607ad18370f460fd4d 100644 index ccf1914b4f48ecc0f4fe980510f42d5415ec1daa..2ea6160492cb23e96271dfbfd3bd35fe03109d6a 100644
--- a/net/minecraft/world/entity/Entity.java --- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java
@@ -4067,6 +4067,19 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -4067,6 +4067,21 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.resetStoredPositions(); this.resetStoredPositions();
} }
+ // Luminol start - Fix sync teleport issue + // Luminol start - Fix sync teleport issue
+ private boolean getNearByEdge(int destX, int destZ) { + private boolean checkNearbyTickRegions(int destX, int destZ) {
+ // Dumb end gateway search the chunks in radius of 5 chunks, so we need keep 6(5+1) by default check radius
+ int sizeBx = Math.min(6, (int) (this.bb.maxX - this.bb.minX) + this.level.getCraftServer().getSimulationDistance()); + int sizeBx = Math.min(6, (int) (this.bb.maxX - this.bb.minX) + this.level.getCraftServer().getSimulationDistance());
+ int sizeBz = Math.min(6, (int) (this.bb.maxZ - this.bb.minZ) + this.level.getCraftServer().getSimulationDistance()); + int sizeBz = Math.min(6, (int) (this.bb.maxZ - this.bb.minZ) + this.level.getCraftServer().getSimulationDistance());
+ +
+ // check tick thread around these area
+ return ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(this.level, + return ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(this.level,
+ (destX >> 4) - sizeBx, + (destX >> 4) - sizeBx,
+ (destZ >> 4) - sizeBz, + (destZ >> 4) - sizeBz,
@@ -28,12 +30,13 @@ index ceca76a5791e319dd7cc4048c9860b1df065b95a..fc7da66320bfd8701b754e607ad18370
protected final void transform(TeleportTransition telpeort) { protected final void transform(TeleportTransition telpeort) {
PositionMoveRotation move = PositionMoveRotation.calculateAbsolute( PositionMoveRotation move = PositionMoveRotation.calculateAbsolute(
PositionMoveRotation.of(this), PositionMoveRotation.of(telpeort), telpeort.relatives() PositionMoveRotation.of(this), PositionMoveRotation.of(telpeort), telpeort.relatives()
@@ -4189,7 +4202,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -4189,7 +4204,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
// check for same region // check for same region
if (destination == this.level()) { if (destination == this.level()) {
Vec3 currPos = this.position(); Vec3 currPos = this.position();
- if ( - if (
+ if (this.getNearByEdge((int) pos.x, (int) pos.z) && // Luminol - Fix sync teleport issue + // Luminol - Prevent entity sync teleported to the edge of tickregion
+ if (this.checkNearbyTickRegions((int) pos.x, (int) pos.z) && // Luminol - Fix sync teleport issue
destination.regioniser.getRegionAtUnsynchronised( destination.regioniser.getRegionAtUnsynchronised(
ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkX(currPos), ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkZ(currPos) ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkX(currPos), ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkZ(currPos)
) == destination.regioniser.getRegionAtUnsynchronised( ) == destination.regioniser.getRegionAtUnsynchronised(

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Portal Behavior Modifiers
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index fc7da66320bfd8701b754e607ad18370f460fd4d..ddea23366c290ce44cc0c6764dffba5aeb63772a 100644 index 2ea6160492cb23e96271dfbfd3bd35fe03109d6a..2871980e53a66bdacf7c00e7045ad01d68a972d3 100644
--- a/net/minecraft/world/entity/Entity.java --- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java
@@ -3304,7 +3304,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -3304,7 +3304,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -51,7 +51,7 @@ index fc7da66320bfd8701b754e607ad18370f460fd4d..ddea23366c290ce44cc0c6764dffba5a
public void addTracker() { public void addTracker() {
for (final EntityTreeNode node : this.getFullTree()) { for (final EntityTreeNode node : this.getFullTree()) {
@@ -4558,6 +4565,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -4561,6 +4568,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
@@ -64,7 +64,7 @@ index fc7da66320bfd8701b754e607ad18370f460fd4d..ddea23366c290ce44cc0c6764dffba5a
protected boolean portalToAsync(ServerLevel destination, BlockPos portalPos, boolean takePassengers, protected boolean portalToAsync(ServerLevel destination, BlockPos portalPos, boolean takePassengers,
PortalType type, java.util.function.Consumer<Entity> teleportComplete) { PortalType type, java.util.function.Consumer<Entity> teleportComplete) {
ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(this, "Cannot portal entity async"); ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(this, "Cannot portal entity async");
@@ -4641,6 +4654,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -4644,6 +4657,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
info.postTeleportTransition().onTransition(teleported); info.postTeleportTransition().onTransition(teleported);
} }

View File

@@ -19,7 +19,7 @@ index 7eff847790394aecd058e7a61905da86163b4c6e..9099457f55a2829297ac1db8a69a98ff
double rangeY = level.paperConfig().entities.trackingRangeY.get(this.entity, -1); double rangeY = level.paperConfig().entities.trackingRangeY.get(this.entity, -1);
if (rangeY != -1) { if (rangeY != -1) {
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index ccf1914b4f48ecc0f4fe980510f42d5415ec1daa..ceca76a5791e319dd7cc4048c9860b1df065b95a 100644 index 2871980e53a66bdacf7c00e7045ad01d68a972d3..2005f769d21de40621beb913446e816b87a03c3a 100644
--- a/net/minecraft/world/entity/Entity.java --- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java
@@ -135,7 +135,7 @@ import net.minecraft.world.scores.ScoreHolder; @@ -135,7 +135,7 @@ import net.minecraft.world.scores.ScoreHolder;
@@ -31,7 +31,7 @@ index ccf1914b4f48ecc0f4fe980510f42d5415ec1daa..ceca76a5791e319dd7cc4048c9860b1d
// CraftBukkit start // CraftBukkit start
private static final int CURRENT_LEVEL = 2; private static final int CURRENT_LEVEL = 2;
@@ -6049,4 +6049,46 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -6080,4 +6080,46 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
// Paper end - Expose entity id counter // Paper end - Expose entity id counter
public boolean shouldTickHot() { return this.tickCount > 20 * 10 && this.isAlive(); } // KioCG public boolean shouldTickHot() { return this.tickCount > 20 * 10 && this.isAlive(); } // KioCG

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Cross Region Damage trace
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index d0853f44f1b4c88ba62a74db9e49a32709685425..aa9b426b848dcc3ce010a58ff5aff291af7a7926 100644 index d0853f44f1b4c88ba62a74db9e49a32709685425..dfe0ebfefae40270e3732fb0dfc593fa8b5803d9 100644
--- a/net/minecraft/server/level/ServerPlayer.java --- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java
@@ -1378,6 +1378,13 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc @@ -1378,6 +1378,13 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -22,17 +22,21 @@ index d0853f44f1b4c88ba62a74db9e49a32709685425..aa9b426b848dcc3ce010a58ff5aff291
} }
this.level().broadcastEntityEvent(this, (byte)3); this.level().broadcastEntityEvent(this, (byte)3);
@@ -1392,6 +1399,20 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc @@ -1392,6 +1399,24 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
this.setClientLoaded(false); this.setClientLoaded(false);
} }
+ // Luminol Start - Cross Region Damage trace + // Luminol Start - Cross Region Damage trace
+ private void damageTransferToAsync(LivingEntity entity, DamageSource cause) { + private void damageTransferToAsync(LivingEntity entity, DamageSource cause) {
+ // Operations running on current entity
+ this.awardStat(Stats.ENTITY_KILLED_BY.get(entity.getType()));
+ this.createWitherRose(entity);
+
+ // the entity might be in another tickregion sometimes, so we need to schedule the task onto the entity
+ // to ensure thread safe
+ entity.getBukkitEntity().taskScheduler.schedule((LivingEntity nmsEntity) -> { + entity.getBukkitEntity().taskScheduler.schedule((LivingEntity nmsEntity) -> {
+ try { + try {
+ this.awardStat(Stats.ENTITY_KILLED_BY.get(nmsEntity.getType()));
+ nmsEntity.awardKillScore(this, cause); + nmsEntity.awardKillScore(this, cause);
+ this.createWitherRose(nmsEntity);
+ } catch (Throwable ex) { + } catch (Throwable ex) {
+ LOGGER.error(ex.getMessage(), ex); + LOGGER.error(ex.getMessage(), ex);
+ } + }