Skip to content

Commit

Permalink
Kaiiju Vanilla end portal teleportation
Browse files Browse the repository at this point in the history
  • Loading branch information
MrHua269 committed Aug 5, 2024
1 parent a4794fb commit 8e876b4
Show file tree
Hide file tree
Showing 34 changed files with 87 additions and 21 deletions.
66 changes: 66 additions & 0 deletions patches/server/0022-Kaiiju-Vanilla-end-portal-teleportation.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: MrHua269 <wangxyper@163.com>
Date: Mon, 5 Aug 2024 14:48:18 +0800
Subject: [PATCH] Kaiiju Vanilla end portal teleportation


diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 39e96b21e77607782da13b4c74c65d8a68af2433..3958bc6d5172698af88555352a5321083c2367d3 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -109,6 +109,7 @@ import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.border.WorldBorder;
+import net.minecraft.world.level.dimension.LevelStem;
import net.minecraft.world.level.entity.EntityAccess;
import net.minecraft.world.level.entity.EntityInLevelCallback;
import net.minecraft.world.level.gameevent.DynamicGameEventListener;
@@ -4229,13 +4230,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
targetPos, 16, // load 16 blocks to be safe from block physics
ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor.Priority.HIGH,
(chunks) -> {
- net.minecraft.world.level.levelgen.feature.EndPlatformFeature.createEndPlatform(destination, targetPos.below(), true, null);
+ //net.minecraft.world.level.levelgen.feature.EndPlatformFeature.createEndPlatform(destination, targetPos.below(), true, null); // Kaiiju - Vanilla end teleportation - moved down

+ // Kaiiju start - Vanilla end teleportation
+ Vec3 finalPos;
+ if (this instanceof Player) finalPos = Vec3.atBottomCenterOf(targetPos.below());
+ else finalPos = Vec3.atBottomCenterOf(targetPos);
+ // Kaiiju end
// 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 net.minecraft.world.level.portal.DimensionTransition(
- destination, Vec3.atBottomCenterOf(targetPos.below()), Vec3.ZERO, 90.0f, 0.0f,
+ destination, Vec3.atBottomCenterOf(targetPos.below()), this.getDeltaMovement(), 90.0f, 0.0f, // Kaiiju - Vanilla end teleportation
DimensionTransition.PLAY_PORTAL_SOUND.then(DimensionTransition.PLACE_PORTAL_TICKET),
org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_PORTAL
)
@@ -4432,6 +4438,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
if (!this.canPortalAsync(destination, takePassengers)) {
return false;
}
+ // Kaiiju start - sync end platform spawning & entity teleportation
+ final java.util.function.Consumer<Entity> tpComplete = type == PortalType.END && destination.getTypeKey() == LevelStem.END ?
+ e -> net.minecraft.world.level.levelgen.feature.EndPlatformFeature.createEndPlatform(destination, ServerLevel.END_SPAWN_POINT.below(), true, null) : teleportComplete;
+ // Kaiiju end

Vec3 initialPosition = this.position();
ChunkPos initialPositionChunk = new ChunkPos(
@@ -4496,9 +4506,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
info.postDimensionTransition().onTransition(teleported);
}

- if (teleportComplete != null) {
+ // Kaiiju start - vanilla end teleportation
+ /*if (teleportComplete != null) {
teleportComplete.accept(teleported);
+ }*/
+ if (tpComplete != null){
+ tpComplete.accept(teleported);
}
+ // Kaiiju end
}
);
});
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ index 0000000000000000000000000000000000000000..0523b3da3fb254bce1998bae6410c632
+ }
+}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 39e96b21e77607782da13b4c74c65d8a68af2433..32f027b67b9bd18e486eb321d8874a1e523c1a00 100644
index 3958bc6d5172698af88555352a5321083c2367d3..44a08cc2e94d52747ba6a66e4b57543dfa5f66c2 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -5259,9 +5259,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -5274,9 +5274,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}

public boolean updateFluidHeightAndDoFluidPushing(TagKey<Fluid> tag, double speed) {
Expand All @@ -50,7 +50,7 @@ index 39e96b21e77607782da13b4c74c65d8a68af2433..32f027b67b9bd18e486eb321d8874a1e
AABB axisalignedbb = this.getBoundingBox().deflate(0.001D);
int i = Mth.floor(axisalignedbb.minX);
int j = Mth.ceil(axisalignedbb.maxX);
@@ -5335,6 +5340,133 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -5350,6 +5355,133 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ index 0000000000000000000000000000000000000000..15697d69659b6e1e776acf5094684b5f
+ }
+}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 32f027b67b9bd18e486eb321d8874a1e523c1a00..c808b59b0461ccd78fa57932f51bbb268c1d965f 100644
index 44a08cc2e94d52747ba6a66e4b57543dfa5f66c2..d5ad15b95a4f1a0145821ca8a6362e4d5722bf7b 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -857,6 +857,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -858,6 +858,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}

public void tick() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ index b5cb700e2cd1de2f78ad582245208c056fa6fa79..80123dd30328336b02a5e2e3414ece44
if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed
entity.discard();
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index c808b59b0461ccd78fa57932f51bbb268c1d965f..0c94d54a380968019aec07d0563f20ceb4fa2ce3 100644
index d5ad15b95a4f1a0145821ca8a6362e4d5722bf7b..577a194e9d9828520560e3546dba8532ca18782a 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -429,6 +429,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -430,6 +430,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
private UUID originWorld;
public boolean freezeLocked = false; // Paper - Freeze Tick Lock API
public boolean fixedPose = false; // Paper - Expand Pose API
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Gale Optimize sun burn tick


diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 0c94d54a380968019aec07d0563f20ceb4fa2ce3..c1953e9860c60c96e31336189e54176fe46f3a3c 100644
index 577a194e9d9828520560e3546dba8532ca18782a..6870db1f03e44e8023e173a0d7a6a7f09f41e989 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -314,7 +314,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -315,7 +315,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
public double xo;
public double yo;
public double zo;
Expand All @@ -17,7 +17,7 @@ index 0c94d54a380968019aec07d0563f20ceb4fa2ce3..c1953e9860c60c96e31336189e54176f
private BlockPos blockPosition;
private ChunkPos chunkPosition;
private Vec3 deltaMovement;
@@ -2121,9 +2121,19 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -2122,9 +2122,19 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
/** @deprecated */
@Deprecated
public float getLightLevelDependentMagicValue() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ index 0000000000000000000000000000000000000000..ed62d25d6cd6dfcf8c5db20ced36eb3d
+ }
+}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index c1953e9860c60c96e31336189e54176fe46f3a3c..3b23cd9d321a5eec5a237983315bf9ec7f76fe7f 100644
index 6870db1f03e44e8023e173a0d7a6a7f09f41e989..928f53951b2c47fb0a5dbae4dc6b8b97f78f4555 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -5544,6 +5544,16 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -5559,6 +5559,16 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return this.inBlockState;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ Subject: [PATCH] Gale Skip entity move if movement is zero


diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 3b23cd9d321a5eec5a237983315bf9ec7f76fe7f..3ff85d9e5ecef61ca5bcec4c260d88e2d5c61bea 100644
index 928f53951b2c47fb0a5dbae4dc6b8b97f78f4555..ceb0bf3071865c85dfa5a270150ff487c2c02c4c 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -323,6 +323,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -324,6 +324,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
public float yRotO;
public float xRotO;
private AABB bb;
+ private boolean boundingBoxChanged = false; // Gale - VMP - skip entity move if movement is zero
public boolean onGround;
public boolean horizontalCollision;
public boolean verticalCollision;
@@ -1136,6 +1137,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -1137,6 +1138,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
//Luminol end

public void move(MoverType movementType, Vec3 movement) {
Expand All @@ -28,7 +28,7 @@ index 3b23cd9d321a5eec5a237983315bf9ec7f76fe7f..3ff85d9e5ecef61ca5bcec4c260d88e2
final Vec3 originalMovement = movement; // Paper - Expose pre-collision velocity
// Paper start - detailed watchdog information
ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread("Cannot move an entity off-main");
@@ -4963,6 +4969,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4978,6 +4984,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}

public final void setBoundingBox(AABB boundingBox) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,10 +332,10 @@ index 1859477e96709368683fe5707327e92f56fbfc8e..4c4814094552fa4382b1cbe649f24f47
+ // KioCG end
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 3ff85d9e5ecef61ca5bcec4c260d88e2d5c61bea..bd0e0cd7888dbb24d941aedd88e9232e98935cab 100644
index ceb0bf3071865c85dfa5a270150ff487c2c02c4c..ae39e58170085f83303d53eb6b7eb72f0a961be3 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -5984,4 +5984,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -5999,4 +5999,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return ((net.minecraft.server.level.ServerChunkCache) level.getChunkSource()).isPositionTicking(this);
}
// Paper end - Expose entity id counter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Fix-MC-2025


diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index bd0e0cd7888dbb24d941aedd88e9232e98935cab..075f3766e51d40fdb4ce2dd36bf19bc4c24d24eb 100644
index ae39e58170085f83303d53eb6b7eb72f0a961be3..133fd4c50df80420015d0c32f487f0176ad07393 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2622,6 +2622,16 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -2623,6 +2623,16 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
nbttagcompound.putBoolean("Paper.FreezeLock", true);
}
// Paper end
Expand All @@ -25,7 +25,7 @@ index bd0e0cd7888dbb24d941aedd88e9232e98935cab..075f3766e51d40fdb4ce2dd36bf19bc4
return nbttagcompound;
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
@@ -2699,6 +2709,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -2700,6 +2710,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.reapplyPosition();
}

Expand Down

0 comments on commit 8e876b4

Please sign in to comment.