128 lines
6.2 KiB
Diff
128 lines
6.2 KiB
Diff
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] Portal Behavior Modifiers
|
|
|
|
|
|
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
|
index 2ea6160492cb23e96271dfbfd3bd35fe03109d6a..2871980e53a66bdacf7c00e7045ad01d68a972d3 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);
|
|
@@ -3829,20 +3829,27 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
|
|
|
EntityTreeNode curr;
|
|
while ((curr = queue.pollFirst()) != null) {
|
|
- EntityTreeNode[] passengers = curr.passengers;
|
|
+ restore(curr); // Luminol - EndGateway Portal Passengers Fix
|
|
+ }
|
|
+ }
|
|
+
|
|
+ // Luminol Start - EndGateway Portal Passengers Fix
|
|
+ private EntityTreeNode[] restore(EntityTreeNode entity) {
|
|
+ EntityTreeNode[] passengers = entity.passengers;
|
|
if (passengers == null) {
|
|
- continue;
|
|
+ return null;
|
|
}
|
|
|
|
List<Entity> newPassengers = new java.util.ArrayList<>();
|
|
for (EntityTreeNode passenger : passengers) {
|
|
+ passenger.passengers = restore(passenger);
|
|
newPassengers.add(passenger.root);
|
|
- passenger.root.vehicle = curr.root;
|
|
+ passenger.root.vehicle = entity.root;
|
|
}
|
|
-
|
|
- curr.root.passengers = ImmutableList.copyOf(newPassengers);
|
|
- }
|
|
+ entity.root.passengers = ImmutableList.copyOf(newPassengers);
|
|
+ return passengers;
|
|
}
|
|
+ // Luminol End - EndGateway Portal Passengers Fix
|
|
|
|
public void addTracker() {
|
|
for (final EntityTreeNode node : this.getFullTree()) {
|
|
@@ -4561,6 +4568,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");
|
|
@@ -4644,6 +4657,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/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
|
|
|
|
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
|
|
}
|