Compare commits

...

19 Commits

Author SHA1 Message Date
MrHua269
8668ac45f4 Fix off tickregion sync teleport & tidy patches 2025-04-29 23:06:36 +08:00
M2ke4U
60a82d9766 Merge pull request #88 from Suisuroru/ss/portal-speed-fix
Entity portal-teleport speed fix
2025-04-28 23:28:54 +08:00
Helvetica Volubi
8d222e6b02 patch: fixup a patch's name 2025-04-28 15:14:39 +08:00
Helvetica Volubi
94e5c047a3 note: fixup note 2025-04-28 12:31:00 +08:00
Helvetica Volubi
55e50ffc54 feat: add flag to process async failed 2025-04-28 12:05:43 +08:00
Helvetica Volubi
b66229fdfb fix: Entity portal-teleport speed fix 2025-04-28 11:53:51 +08:00
M2ke4U
c4d910f38e Merge pull request #87 from Suisuroru/ss/tnt-teleport-fix
TNT Nether Portal break portal fix
2025-04-27 22:36:12 +08:00
Helvetica Volubi
f1a0c96c7f fixup note 2025-04-27 20:14:58 +08:00
Helvetica Volubi
8cfa995a1c Merge remote-tracking branch 'origin/ss/tnt-teleport-fix' into ss/tnt-teleport-fix 2025-04-27 20:09:00 +08:00
Helvetica Volubi
c542cc1d2d feat: add afterPortalLogic to process some logics 2025-04-27 20:07:08 +08:00
Helvetica Volubi
34df6067cf ci: update build_1.21.4.yml
fix an error in a file name
2025-04-27 17:21:02 +08:00
Helvetica Volubi
d61c5e92bf fix: TNT Nether Portal break portal fix 2025-04-27 14:27:00 +08:00
M2ke4U
2f052a116f Merge pull request #86 from Suisuroru/dev/1.21.4-hardfork
move 0044 to todo list
2025-04-26 23:49:40 +08:00
Helvetica Volubi
9902d94d10 remove: move 0044 to todo list 2025-04-26 23:28:34 +08:00
M2ke4U
4098be9279 Merge pull request #84 from Suisuroru/ss/leaves471
Leaves Fix SculkCatalyst exp skip
2025-04-26 23:11:53 +08:00
M2ke4U
27f7d44d3b Merge pull request #85 from Suisuroru/ss/respawn-fix-radius=0
Correct player respawn place
2025-04-26 23:11:44 +08:00
Helvetica Volubi
c06ddc3b10 note: use Correct player respawn place as tag 2025-04-26 23:08:02 +08:00
Helvetica Volubi
3a5f608a84 fix: Player respawn in correct place 2025-04-26 21:50:31 +08:00
Helvetica Volubi
fa10f4cc52 Leaves Fix SculkCatalyst exp skip (Leaves#471) 2025-04-25 23:55:05 +08:00
33 changed files with 311 additions and 4 deletions

View File

@@ -41,7 +41,7 @@ jobs:
uses: "actions/upload-artifact@v4"
with:
name: "${{ env.project_id_b }} CI Artifacts"
path: "luminol-server/build/libs/*-paperclip.jar"
path: "luminol-server/build/libs/*-paperclip-*-mojmap.jar"
- name: SetENV
if: github.event_name != 'pull_request'
run: sh scripts/SetENV.sh

View File

@@ -0,0 +1,88 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: violetc <58360096+s-yh-china@users.noreply.github.com>
Date: Sun, 6 Apr 2025 10:42:47 +0800
Subject: [PATCH] Fix SculkCatalyst exp skip
diff --git a/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java b/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java
index 42ffb81708b327f765ba3235fdd1ab69cd7589fd..0a7e37420f8d024ffba1fd1c52edc50c10408e6e 100644
--- a/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java
+++ b/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java
@@ -25,17 +25,25 @@ public class EntityDeathEvent extends EntityEvent implements org.bukkit.event.Ca
private float deathSoundVolume;
private float deathSoundPitch;
// Paper end
+ private int rewardExp; // Leaves - exp fix
public EntityDeathEvent(@NotNull final LivingEntity entity, @NotNull DamageSource damageSource, @NotNull final List<ItemStack> drops) {
this(entity, damageSource, drops, 0);
}
public EntityDeathEvent(@NotNull final LivingEntity what, @NotNull DamageSource damageSource, @NotNull final List<ItemStack> drops, final int droppedExp) {
+ // Leaves start - exp fix
+ this(what, damageSource, drops, droppedExp, droppedExp);
+ }
+
+ public EntityDeathEvent(@NotNull final LivingEntity what, @NotNull DamageSource damageSource, @NotNull final List<ItemStack> drops, final int droppedExp, final int rewardExp) {
super(what);
this.damageSource = damageSource;
this.drops = drops;
this.dropExp = droppedExp;
+ this.rewardExp = rewardExp;
}
+ // Leaves end - exp fix
@NotNull
@Override
@@ -75,6 +83,7 @@ public class EntityDeathEvent extends EntityEvent implements org.bukkit.event.Ca
*/
public void setDroppedExp(int exp) {
this.dropExp = exp;
+ this.rewardExp = exp; // Leaves - exp fix
}
/**
@@ -226,4 +235,14 @@ public class EntityDeathEvent extends EntityEvent implements org.bukkit.event.Ca
this.deathSoundPitch = pitch;
}
// Paper end
+
+ // Leaves start - exp fix
+ public int getRewardExp() {
+ return rewardExp;
+ }
+
+ public void setRewardExp(int rewardExp) {
+ this.rewardExp = rewardExp;
+ }
+ // Leaves end - exp fix
}
diff --git a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
index ab7584873e46020148bceecbd42a43055684e6a0..7c99b1c6f5fc8e4ce442d111e7598ddb89d6ee05 100644
--- a/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
+++ b/src/main/java/org/bukkit/event/entity/PlayerDeathEvent.java
@@ -18,6 +18,7 @@ public class PlayerDeathEvent extends EntityDeathEvent {
private boolean keepLevel = false;
private boolean keepInventory = false;
private boolean doExpDrop; // Paper - shouldDropExperience API
+ private boolean useApiExpDropStatus = false; // Leaves - exp fix
// Paper start - adventure
@org.jetbrains.annotations.ApiStatus.Internal
public PlayerDeathEvent(final @NotNull Player player, final @NotNull DamageSource damageSource, final @NotNull List<ItemStack> drops, final int droppedExp, final @Nullable net.kyori.adventure.text.Component deathMessage) {
@@ -122,9 +123,16 @@ public class PlayerDeathEvent extends EntityDeathEvent {
*/
public void setShouldDropExperience(boolean doExpDrop) {
this.doExpDrop = doExpDrop;
+ this.useApiExpDropStatus = true; // Leaves - exp fix
}
// Paper end - shouldDropExperience API
+ // Leaves start - exp fix
+ public boolean forceUseEventDropStatus() {
+ return this.useApiExpDropStatus;
+ }
+ // Leaves end - exp fix
+
@NotNull
@Override
public Player getEntity() {

View File

@@ -0,0 +1,45 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
Date: Sat, 26 Apr 2025 21:47:45 +0800
Subject: [PATCH] Correct player respawn place
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index 3bc0fc1d411d3c5e206695510ec9288ffbf8c277..b6df8df78105e08ca7be82524685d8b9422abf21 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -472,8 +472,10 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
double amountX = selectMaxX - selectMinX;
double amountZ = selectMaxZ - selectMinZ;
- int selectX = amountX < 1.0 ? Mth.floor(worldBorder.getCenterX()) : (int)Mth.floor((amountX + 1.0) * random.nextDouble() + selectMinX);
- int selectZ = amountZ < 1.0 ? Mth.floor(worldBorder.getCenterZ()) : (int)Mth.floor((amountZ + 1.0) * random.nextDouble() + selectMinZ);
+ // Luminol start - Correct player respawn place
+ int selectX = amountX < 0.0 ? Mth.floor(worldBorder.getCenterX()) : (int)Mth.floor(amountX * random.nextDouble() + selectMinX);
+ int selectZ = amountZ < 0.0 ? Mth.floor(worldBorder.getCenterZ()) : (int)Mth.floor(amountZ * random.nextDouble() + selectMinZ);
+ // Luminol end - Correct player respawn place
return new BlockPos(selectX, 0, selectZ);
}
@@ -484,10 +486,20 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
}
private static BlockPos findSpawnAround(ServerLevel world, ServerPlayer player, BlockPos selected) {
+ // Luminol start - Correct player respawn place
+ BlockPos inChunk;
+ inChunk = PlayerRespawnLogic.getOverworldRespawnPos(world, selected.getX(), selected.getZ());
+ if (inChunk != null) {
+ AABB checkVolume = player.getBoundingBoxAt((double)inChunk.getX() + 0.5, (double)inChunk.getY(), (double)inChunk.getZ() + 0.5);
+ if (player.noCollisionNoLiquid(world, checkVolume)) {
+ return inChunk;
+ }
+ }
+ // Luminol end - Correct player respawn place
// try hard to find, so that we don't attempt another chunk load
for (int dz = -SPAWN_RADIUS_SELECTION_SEARCH; dz <= SPAWN_RADIUS_SELECTION_SEARCH; ++dz) {
for (int dx = -SPAWN_RADIUS_SELECTION_SEARCH; dx <= SPAWN_RADIUS_SELECTION_SEARCH; ++dx) {
- BlockPos inChunk = PlayerRespawnLogic.getOverworldRespawnPos(world, selected.getX() + dx, selected.getZ() + dz);
+ inChunk = PlayerRespawnLogic.getOverworldRespawnPos(world, selected.getX() + dx, selected.getZ() + dz); // Luminol - Correct player respawn place
if (inChunk == null) {
continue;
}

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Add missing teleportation apis for folia
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index 3bc0fc1d411d3c5e206695510ec9288ffbf8c277..c2562b8f7ca3bc815a5abe5ae00a6fe1654b002d 100644
index b6df8df78105e08ca7be82524685d8b9422abf21..98ce0736c18cbb09704ef7ca6b67866d5736f7c7 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -1661,6 +1661,9 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
@@ -1673,6 +1673,9 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
if (respawnComplete != null) {
respawnComplete.accept(ServerPlayer.this);
}

View File

@@ -4,6 +4,35 @@ Date: Sun, 6 Apr 2025 10:42:45 +0800
Subject: [PATCH] Leaves Fix SculkCatalyst exp skip
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index 98ce0736c18cbb09704ef7ca6b67866d5736f7c7..d0853f44f1b4c88ba62a74db9e49a32709685425 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -1358,7 +1358,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
}
// SPIGOT-5478 must be called manually now
- if (event.shouldDropExperience()) this.dropExperience(this.serverLevel(), cause.getEntity()); // Paper - tie to event
+ if (shouldDropExperience(event.shouldDropExperience(), event.forceUseEventDropStatus())) this.dropExperience(this.serverLevel(), cause.getEntity()); // Paper - tie to event // Leaves - exp fix
// we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.
if (!event.getKeepInventory()) {
// Paper start - PlayerDeathEvent#getItemsToKeep
@@ -1392,6 +1392,15 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
this.setClientLoaded(false);
}
+ // Leaves start - exp fix
+ private boolean shouldDropExperience(boolean eventResult, boolean forceUseEvent) {
+ if (forceUseEvent) {
+ return eventResult;
+ }
+ return wasExperienceConsumed() ? false : eventResult;
+ }
+ // Leaves end - exp fix
+
private void tellNeutralMobsThatIDied() {
AABB aabb = new AABB(this.blockPosition()).inflate(32.0, 10.0, 32.0);
this.level()
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index 2293c3db45e9ecce4e0d4b2f87b8e90228e44d94..658aa09aecf8d64145feedb82dc9be2a55201450 100644
--- a/net/minecraft/world/entity/LivingEntity.java

View File

@@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Bacteriawa <A3167717663@hotmail.com>
Date: Thu, 7 Nov 2024 21:50:47 +0100
Subject: [PATCH] Lithium: fast util
Subject: [PATCH] Lithium: Fast util
This patch is based on the following mixins:
* "net/caffeinemc/mods/lithium/mixin/math/fast_util/DirectionMixin.java"

View File

@@ -0,0 +1,42 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <mrhua269@gmail.com>
Date: Thu, 24 Apr 2025 23:11:13 +0800
Subject: [PATCH] Fix off tickregion sync teleport
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index ceca76a5791e319dd7cc4048c9860b1df065b95a..4a0d07a3263704a7c6e6859ddcbe767c202ed794 100644
--- a/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
this.resetStoredPositions();
}
+ // Luminol start - Fix sync teleport issue
+ private boolean getNearByEdge(int destX, int destZ) {
+ 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());
+
+ return ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(this.level,
+ (destX >> 4) - sizeBx,
+ (destZ >> 4) - sizeBz,
+ (destX >> 4) + sizeBx,
+ (destZ >> 4) + sizeBz);
+ }
+ // Luminol end
+
protected final void transform(TeleportTransition telpeort) {
PositionMoveRotation move = PositionMoveRotation.calculateAbsolute(
PositionMoveRotation.of(this), PositionMoveRotation.of(telpeort), telpeort.relatives()
@@ -4186,10 +4199,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
wrapped.callEvent();
// Luminol end
- // check for same region
if (destination == this.level()) {
Vec3 currPos = this.position();
- if (
+ if (this.getNearByEdge((int) pos.x, (int) pos.z) && // Luminol - Fix sync teleport issue
destination.regioniser.getRegionAtUnsynchronised(
ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkX(currPos), ca.spottedleaf.moonrise.common.util.CoordinateUtils.getChunkZ(currPos)
) == destination.regioniser.getRegionAtUnsynchronised(

View File

@@ -0,0 +1,47 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
Date: Sun, 27 Apr 2025 14:26:01 +0800
Subject: [PATCH] Add afterPortalLogic to process some logics
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 4a0d07a3263704a7c6e6859ddcbe767c202ed794..dc0a9f39751173824d8cef569f94b459ee6e94dc 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -4557,6 +4557,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
+ // Luminol start - Add afterPortalLogic
+ protected void afterPortalLogic() {
+
+ }
+ // Luminol end - Add afterPortalLogic
+
protected boolean portalToAsync(ServerLevel destination, BlockPos portalPos, boolean takePassengers,
PortalType type, java.util.function.Consumer<Entity> teleportComplete) {
ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(this, "Cannot portal entity async");
@@ -4640,6 +4646,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
info.postTeleportTransition().onTransition(teleported);
}
+ teleported.afterPortalLogic(); // Luminol - Add afterPortalLogic
+
// Kaiiju start - vanilla end teleportation
/*if (teleportComplete != null) {
teleportComplete.accept(teleported);
diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java
index 88570bb4aa02896545805d7721c45cf9599befea..bbf9748a36404139356db606dbb3b0cc13c66b50 100644
--- a/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/net/minecraft/world/entity/item/PrimedTnt.java
@@ -251,4 +251,10 @@ public class PrimedTnt extends Entity implements TraceableEntity {
return !this.level().paperConfig().fixes.preventTntFromMovingInWater && super.isPushedByFluid();
}
// Paper end - Option to prevent TNT from moving in water
+
+ // Luminol start - Add afterPortalLogic
+ protected void afterPortalLogic() {
+ this.setUsedPortal(true);
+ }
+ // Luminol start - Add afterPortalLogic
}

View File

@@ -0,0 +1,56 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Helvetica Volubi <suisuroru@blue-millennium.fun>
Date: Mon, 28 Apr 2025 11:53:13 +0800
Subject: [PATCH] Entity portal-teleport speed fix
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index dc0a9f39751173824d8cef569f94b459ee6e94dc..a4e5c5675dc09f598a6ae05d7aea21b48e451b21 100644
--- a/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
this.setPortalCooldown();
} else {
if (this.portalProcess == null || !this.portalProcess.isSamePortal(portal)) {
- this.portalProcess = new PortalProcessor(portal, pos.immutable());
+ this.portalProcess = new PortalProcessor(portal, pos.immutable(), this.getDeltaMovement()); // Luminol - Entity portal-teleport speed fix
} else if (!this.portalProcess.isInsidePortalThisTick()) {
this.portalProcess.updateEntryPosition(pos.immutable());
this.portalProcess.setAsInsidePortalThisTick(true);
diff --git a/net/minecraft/world/entity/PortalProcessor.java b/net/minecraft/world/entity/PortalProcessor.java
index 46d989aef0eceebd98bfd93999153319de77a8a0..6e9171fa0c636439bd96401ea9e5fe80ffdc8bdd 100644
--- a/net/minecraft/world/entity/PortalProcessor.java
+++ b/net/minecraft/world/entity/PortalProcessor.java
@@ -9,12 +9,14 @@ import net.minecraft.world.level.portal.TeleportTransition;
public class PortalProcessor {
private final Portal portal;
private BlockPos entryPosition;
+ private net.minecraft.world.phys.Vec3 speedVec3; // Luminol - Entity portal-teleport speed fix
private int portalTime;
private boolean insidePortalThisTick;
- public PortalProcessor(Portal portal, BlockPos entryPosition) {
+ public PortalProcessor(Portal portal, BlockPos entryPosition, net.minecraft.world.phys.Vec3 speedVec3) { // Luminol - Entity portal-teleport speed fix
this.portal = portal;
this.entryPosition = entryPosition;
+ this.speedVec3 = speedVec3; // Luminol - Entity portal-teleport speed fix
this.insidePortalThisTick = true;
}
@@ -35,7 +37,15 @@ public class PortalProcessor {
// Folia start - region threading
public boolean portalAsync(ServerLevel sourceWorld, Entity portalTarget) {
- return this.portal.portalAsync(sourceWorld, portalTarget, this.entryPosition);
+ // Luminol start - Entity portal-teleport speed fix
+ net.minecraft.world.phys.Vec3 oldSpeed = portalTarget.getDeltaMovement();
+ portalTarget.setDeltaMovement(this.speedVec3);
+ boolean flag = this.portal.portalAsync(sourceWorld, portalTarget, this.entryPosition);
+ if (!flag) {
+ portalTarget.setDeltaMovement(oldSpeed);
+ }
+ return flag;
+ // Luminol end - Entity portal-teleport speed fix
}
// Folia end - region threading