Compare commits

..

3 Commits

Author SHA1 Message Date
M2ke4U
fc7212133f Try fixing folia spector teleportation 2023-11-26 21:24:46 +08:00
M2ke4U
97e6bf22ac Updated README.md 2023-11-26 21:03:39 +08:00
M2ke4U
9e6576a727 Kaiiju Vanilla end portal teleportation 2023-11-26 20:27:18 +08:00
3 changed files with 160 additions and 4 deletions

View File

@@ -5,20 +5,20 @@
![CodeFactor Grade](https://img.shields.io/codefactor/grade/github/LuminolMC/Luminol?style=flat-square)
![GitHub all releases](https://img.shields.io/github/downloads/LuminolMC/Luminol/total?style=flat-square)
<h4>Luminol is a folia fork that with many useful optimizations, configurable vanilla features, more API supports, and it was designed for survival and anarchy servers</h4>
<h4>Luminol is a folia fork with many useful optimizations, configurable vanilla features, and more API supports, and it was designed for survival and anarchy servers</h4>
## Features
- Configurable vanilla features
- Tpsbar support
- Linear region file format(from kaiiju)
- Useful optimizations to improve the performance of single threaded region
- More API supports for plugin developing(W.I.P)
- More API support for plugin development (W.I.P)
## Download
Any versions are available in [release](https://github.com/LuminolMC/Luminol/releases),also you can build it by yourself through the following steps.
Any versions are available in the [release](https://github.com/LuminolMC/Luminol/releases), also you can build it by yourself through the following steps.
## Build
To build a paperclip jar,you need run the following command.And you can find the jar in build/libs(Note: JDK17 in needed)
To build a paperclip jar, you need to run the following command. You can find the jar in build/libs(Note: JDK17 is needed)
```shell
./gradlew applyPatches && ./gradlew createReobfPaperclipJar
```

View File

@@ -0,0 +1,50 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: M2ke4U <79621885+MrHua269@users.noreply.github.com>
Date: Sun, 26 Nov 2023 20:25:38 +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 6f3e87661c3181b6537e4d6d96e50d8d5680c040..3a5c8f1f9a8173777b00d43c15e8e313526d3e28 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4108,12 +4108,17 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
targetPos, 16, // load 16 blocks to be safe from block physics
ca.spottedleaf.concurrentutil.executor.standard.PrioritisedExecutor.Priority.HIGH,
(chunks) -> {
- ServerLevel.makeObsidianPlatform(destination, null, targetPos);
+ //ServerLevel.makeObsidianPlatform(destination, null, targetPos); // 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 PortalInfo(Vec3.atBottomCenterOf(targetPos.below()), Vec3.ZERO, 90.0f, 0.0f, destination, null)
+ new PortalInfo(finalPos, this.getDeltaMovement(), 90.0f, 0.0f, destination, null) // Kaiiju - Vanilla end teleportation
);
}
);
@@ -4300,6 +4305,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
if (!this.canPortalAsync(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 -> ServerLevel.makeObsidianPlatform(destination, null, ServerLevel.END_SPAWN_POINT) : teleportComplete;
+ // Kaiiju end
Vec3 initialPosition = this.position();
ChunkPos initialPositionChunk = new ChunkPos(
@@ -4358,7 +4367,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
// place
passengerTree.root.placeInAsync(
originWorld, destination, Entity.TELEPORT_FLAG_LOAD_CHUNK | (takePassengers ? Entity.TELEPORT_FLAG_TELEPORT_PASSENGERS : 0L),
- passengerTree, teleportComplete
+ passengerTree, tpComplete // Kaiiju - vanilla end teleportation
);
});

View File

@@ -0,0 +1,106 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: M2ke4U <79621885+MrHua269@users.noreply.github.com>
Date: Sun, 26 Nov 2023 21:23:06 +0800
Subject: [PATCH] Try fixing folia spector teleportation
diff --git a/src/main/java/me/earthme/luminol/LuminolConfig.java b/src/main/java/me/earthme/luminol/LuminolConfig.java
index d032786938db9725e1be72dae63a1387bcb69d79..08536bd5bbea3a9bb9d4c6212d361570c1d365bd 100644
--- a/src/main/java/me/earthme/luminol/LuminolConfig.java
+++ b/src/main/java/me/earthme/luminol/LuminolConfig.java
@@ -37,6 +37,7 @@ public class LuminolConfig {
public static boolean enableVoidTrading = false;
public static boolean allowIncorrectTripwireUpdating = false;
public static boolean useVanillaRandomSource = false;
+ public static boolean fixSpectorTeleportFolia = false;
public static RegionFileFormat regionFormatName = RegionFileFormat.ANVIL;
public static int regionFormatLinearCompressionLevel = 1;
@@ -130,6 +131,7 @@ public class LuminolConfig {
tpsColors = get("misc.tpsbar_range_colors", List.of(tpsColors),"The bar and text color of each tps ranges.The last is the color of initial bar's color").toArray(String[]::new);
pingColors = get("misc.tpsbar_ping_range_colors",List.of(pingColors),"As same as the tpsColors").toArray(String[]::new);
disableUsernameCheck = get("misc.disable_username_check",disableUsernameCheck,"Disable username check that can accept usernames with other characters(such as Chinese).Not recommended to use");
+ fixSpectorTeleportFolia = get("misc.fix_folia_spector_teleport",fixSpectorTeleportFolia);
if (tpsbarEnabled){
initTpsbar();
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 97bfb92e52c3c5ef1cd22afe2b97c204eb45025a..d0ceec72b56741b35cc090e7c9d2c642b8709449 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -18,6 +18,9 @@ import java.util.Optional;
import java.util.OptionalInt;
import java.util.Set;
import javax.annotation.Nullable;
+
+import io.papermc.paper.util.TickThread;
+import me.earthme.luminol.LuminolConfig;
import net.minecraft.BlockUtil;
import net.minecraft.ChatFormatting;
import net.minecraft.CrashReport;
@@ -835,26 +838,54 @@ public class ServerPlayer extends Player {
Entity entity = this.getCamera();
+ boolean shouldTickRemainingThisThread = true;//Luminol - Fix spector camera
if (entity != this) {
if (entity.isAlive()) {
- this.absMoveTo(entity.getX(), entity.getY(), entity.getZ(), entity.getYRot(), entity.getXRot());
- this.serverLevel().getChunkSource().move(this);
- if (this.wantsToStopRiding()) {
- this.setCamera(this);
+ //Luminol start - Fix spector camera
+ if (TickThread.isTickThreadFor(entity) || !LuminolConfig.fixSpectorTeleportFolia){
+ this.absMoveTo(entity.getX(), entity.getY(), entity.getZ(), entity.getYRot(), entity.getXRot());
+ }else{
+ shouldTickRemainingThisThread = false;
+ this.teleportAsync(
+ ((ServerLevel) entity.level()),
+ entity.position,
+ entity.getYRot(),
+ entity.getXRot(),
+ null,
+ TeleportCause.SPECTATE,
+ Entity.TELEPORT_FLAG_LOAD_CHUNK | Entity.TELEPORT_FLAG_TELEPORT_PASSENGERS,
+ r -> {
+ this.serverLevel().getChunkSource().move(this);
+ if (this.wantsToStopRiding()) {
+ this.setCamera(this);
+ }
+ CriteriaTriggers.TICK.trigger(this);
+ if (this.levitationStartPos != null) {
+ CriteriaTriggers.LEVITATION.trigger(this, this.levitationStartPos, this.tickCount - this.levitationStartTime);
+ }
+
+ this.trackStartFallingPosition();
+ this.trackEnteredOrExitedLavaOnVehicle();
+ this.advancements.flushDirty(this);
+ }
+ );
}
+ //Luminol end
} else {
this.setCamera(this);
}
}
- CriteriaTriggers.TICK.trigger(this);
- if (this.levitationStartPos != null) {
- CriteriaTriggers.LEVITATION.trigger(this, this.levitationStartPos, this.tickCount - this.levitationStartTime);
- }
+ if (shouldTickRemainingThisThread){ //Luminol - Fix spector camera
+ CriteriaTriggers.TICK.trigger(this);
+ if (this.levitationStartPos != null) {
+ CriteriaTriggers.LEVITATION.trigger(this, this.levitationStartPos, this.tickCount - this.levitationStartTime);
+ }
- this.trackStartFallingPosition();
- this.trackEnteredOrExitedLavaOnVehicle();
- this.advancements.flushDirty(this);
+ this.trackStartFallingPosition();
+ this.trackEnteredOrExitedLavaOnVehicle();
+ this.advancements.flushDirty(this);
+ }
}
public void doTick() {