mirror of
https://github.com/PaperMC/Folia.git
synced 2024-11-25 12:35:23 +01:00
Vanilla end teleportation
Player should be teleported to Vec3.atBottomCenterOf(targetPos.below()); Other entities should be teleported to Vec3.atBottomCenterOf(targetPos); And end-teleportation keep velocity (this.getDeltaMovement)
This commit is contained in:
parent
801cff1570
commit
34465611d1
@ -17684,7 +17684,7 @@ index ea27b46eec01bda427653335f922ccd068cffcb5..e551d3b875eab6851b75041f418c9a08
|
||||
return blockToFallLocation(blockState);
|
||||
} else {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index b38c4cbcf0405d82c7b6e018e80a3174e460c1a4..5a71b5a37a55baea204821aba734d53dc49cb336 100644
|
||||
index b38c4cbcf0405d82c7b6e018e80a3174e460c1a4..edf569f2c7c3178e03898f2aa26c0da4586c2cb4 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -166,7 +166,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@ -17867,7 +17867,7 @@ index b38c4cbcf0405d82c7b6e018e80a3174e460c1a4..5a71b5a37a55baea204821aba734d53d
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -3506,6 +3532,771 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -3506,6 +3532,773 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
this.portalEntrancePos = original.portalEntrancePos;
|
||||
}
|
||||
|
||||
@ -18376,11 +18376,13 @@ index b38c4cbcf0405d82c7b6e018e80a3174e460c1a4..5a71b5a37a55baea204821aba734d53d
|
||||
+ ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor.Priority.HIGH,
|
||||
+ (chunks) -> {
|
||||
+ ServerLevel.makeObsidianPlatform(destination, null, targetPos);
|
||||
+
|
||||
+ Vec3 finalPos;
|
||||
+ if (this instanceof Player) finalPos = Vec3.atBottomCenterOf(targetPos.below());
|
||||
+ else finalPos = Vec3.atBottomCenterOf(targetPos);
|
||||
+ // the portal obsidian is placed at targetPos.y - 2, so if we want to place the entity
|
||||
+ // on the obsidian, we need to spawn at targetPos.y - 1
|
||||
+ portalInfoCompletable.complete(
|
||||
+ new PortalInfo(Vec3.atBottomCenterOf(targetPos.below()), Vec3.ZERO, 90.0f, 0.0f, destination, null)
|
||||
+ new PortalInfo(finalPos, this.getDeltaMovement(), 90.0f, 0.0f, destination, null)
|
||||
+ );
|
||||
+ }
|
||||
+ );
|
||||
@ -18639,7 +18641,7 @@ index b38c4cbcf0405d82c7b6e018e80a3174e460c1a4..5a71b5a37a55baea204821aba734d53d
|
||||
@Nullable
|
||||
public Entity changeDimension(ServerLevel destination) {
|
||||
// CraftBukkit start
|
||||
@@ -3514,6 +4305,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -3514,6 +4307,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
|
||||
@Nullable
|
||||
public Entity teleportTo(ServerLevel worldserver, PositionImpl location) {
|
||||
@ -18651,7 +18653,7 @@ index b38c4cbcf0405d82c7b6e018e80a3174e460c1a4..5a71b5a37a55baea204821aba734d53d
|
||||
// CraftBukkit end
|
||||
// Paper start - fix bad state entities causing dupes
|
||||
if (!this.isAlive() || !this.valid) {
|
||||
@@ -3597,6 +4393,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -3597,6 +4395,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
}
|
||||
}
|
||||
|
||||
@ -18664,7 +18666,7 @@ index b38c4cbcf0405d82c7b6e018e80a3174e460c1a4..5a71b5a37a55baea204821aba734d53d
|
||||
protected void removeAfterChangingDimensions() {
|
||||
this.setRemoved(Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
}
|
||||
@@ -4041,17 +4843,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -4041,17 +4845,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
|
||||
// Paper start
|
||||
public void startSeenByPlayer(ServerPlayer player) {
|
||||
@ -18684,7 +18686,7 @@ index b38c4cbcf0405d82c7b6e018e80a3174e460c1a4..5a71b5a37a55baea204821aba734d53d
|
||||
}
|
||||
// Paper end
|
||||
|
||||
@@ -4546,7 +5344,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -4546,7 +5346,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
}
|
||||
}
|
||||
// Paper end - fix MC-4
|
||||
@ -18694,7 +18696,7 @@ index b38c4cbcf0405d82c7b6e018e80a3174e460c1a4..5a71b5a37a55baea204821aba734d53d
|
||||
synchronized (this.posLock) { // Paper
|
||||
this.position = new Vec3(x, y, z);
|
||||
} // Paper
|
||||
@@ -4567,7 +5366,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -4567,7 +5368,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
|
||||
// Paper start - never allow AABB to become desynced from position
|
||||
// hanging has its own special logic
|
||||
@ -18703,7 +18705,7 @@ index b38c4cbcf0405d82c7b6e018e80a3174e460c1a4..5a71b5a37a55baea204821aba734d53d
|
||||
this.setBoundingBox(this.makeBoundingBox());
|
||||
}
|
||||
// Paper end
|
||||
@@ -4654,6 +5453,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -4654,6 +5455,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
return this.removalReason != null;
|
||||
}
|
||||
|
||||
@ -18716,7 +18718,7 @@ index b38c4cbcf0405d82c7b6e018e80a3174e460c1a4..5a71b5a37a55baea204821aba734d53d
|
||||
@Nullable
|
||||
public Entity.RemovalReason getRemovalReason() {
|
||||
return this.removalReason;
|
||||
@@ -4678,7 +5483,23 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
@@ -4678,7 +5485,23 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
|
||||
if (reason != RemovalReason.UNLOADED_TO_CHUNK) this.getPassengers().forEach(Entity::stopRiding); // Paper - chunk system - don't adjust passenger state when unloading, it's just not safe (and messes with our logic in entity chunk unload)
|
||||
this.levelCallback.onRemove(reason);
|
||||
|
@ -51,7 +51,7 @@ index d9687722e02dfd4088c7030abbf5008eb0a092c8..62484ebf4550b05182f693a3180bbac5
|
||||
TickThread.ensureTickThread(thisEntity, "May not tick entity scheduler asynchronously");
|
||||
final List<ScheduledTask> toRun;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 5a71b5a37a55baea204821aba734d53dc49cb336..27b57db24587337ccdce29e492052ca419863323 100644
|
||||
index edf569f2c7c3178e03898f2aa26c0da4586c2cb4..d267946e49465837a1c2489ce1782c1f0e229d25 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2889,6 +2889,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
||||
|
Loading…
Reference in New Issue
Block a user