Compare commits

...

5 Commits

Author SHA1 Message Date
Sofiane H. Djerbi
d58b595ce8 Code cleanup / hotfix 2023-05-28 03:41:06 +03:00
Sofiane H. Djerbi
9e237681ce Latest fixes 2023-05-28 03:07:04 +03:00
Sofiane H. Djerbi
26c4ffa7c6 Finish vanilla 2023-05-28 03:00:57 +03:00
Sofiane H. Djerbi
5500bd404d Add velocity back 2023-05-20 03:14:27 +03:00
Sofiane H. Djerbi
d27a0cfa94 End portal tweaks 2023-05-19 05:19:07 +03:00
5 changed files with 135 additions and 4 deletions

View File

@@ -133,7 +133,7 @@ index abe37c7c3c6f5ab73afd738ec78f06d7e4d2ed96..52fc6bb99f6024273c7438d01314b576
stringbuilder.append(CrashReport.DATE_TIME_FORMATTER.format(ZonedDateTime.now())); stringbuilder.append(CrashReport.DATE_TIME_FORMATTER.format(ZonedDateTime.now()));
stringbuilder.append("\n"); stringbuilder.append("\n");
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index f5721f6d719b7055fdccc81d5e67ed758e90cb10..0696ad97437726fd6a13badfe7db0617dfbfb1ad 100644 index 61bac6fda2d2f4b3db8a3f7e3003f47c84d5c4cd..19d6b811dccdc2b7a22054d3fe72b3981a6aae3a 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -999,7 +999,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -999,7 +999,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -145,7 +145,7 @@ index f5721f6d719b7055fdccc81d5e67ed758e90cb10..0696ad97437726fd6a13badfe7db0617
while (this.getRunningThread().isAlive()) { while (this.getRunningThread().isAlive()) {
this.getRunningThread().stop(); this.getRunningThread().stop();
try { try {
@@ -1833,7 +1833,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1815,7 +1815,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@DontObfuscate @DontObfuscate
public String getServerModName() { public String getServerModName() {

View File

@@ -19,10 +19,10 @@ index 6d0e1edfb7d3c020f70f6a194f16e836b462c4de..9fb33b35b4d6842ca8597f77a4116e39
} }
} }
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index a7233bcc99e9bf148348ebb36bbb15b2eadb381f..865b022bb52d8d7b12355a01f3216a4ee8d4c045 100644 index a2cb5aae38e8666da8c8f3b5095d426c62371a3b..2ee67890df46c8eb23c387519721c88b762599ce 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java --- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1833,7 +1833,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1815,7 +1815,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@DontObfuscate @DontObfuscate
public String getServerModName() { public String getServerModName() {

View File

@@ -0,0 +1,56 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
Date: Thu, 18 May 2023 20:05:49 +0300
Subject: [PATCH] Toggle safe teleportation
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
index 8026f9ac95cd54e74ff7e161fe4768830f8e0d30..bf23ddc5fdc274c9fc755f64d30d6792c9f4b0da 100644
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
@@ -152,6 +152,7 @@ public class KaiijuWorldConfig {
public boolean tickWhenEmpty = true;
public boolean breakRedstoneOnTopOfTrapDoorsEarly = true;
public boolean fixTripWireStateInconsistency = true;
+ public boolean safeTeleporting = true;
private void gameplaySettings() {
shulkerBoxDropContentsWhenDestroyed = getBoolean("gameplay.shulker-box-drop-contents-when-destroyed", shulkerBoxDropContentsWhenDestroyed);
@@ -160,5 +161,6 @@ public class KaiijuWorldConfig {
tickWhenEmpty = getBoolean("gameplay.tick-when-empty", tickWhenEmpty);
breakRedstoneOnTopOfTrapDoorsEarly = getBoolean("gameplay.break-redstone-on-top-of-trap-doors-early", breakRedstoneOnTopOfTrapDoorsEarly);
fixTripWireStateInconsistency = getBoolean("gameplay.fix-tripwire-state-inconsistency", fixTripWireStateInconsistency);
+ safeTeleporting = getBoolean("gameplay.safe-teleportation", safeTeleporting);
}
}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index f22b4ad629845462656834abb3e28d2c2588ace6..7af60ebb91fb39374355c64396b6adc48b2a5f89 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3826,6 +3826,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
protected boolean tryEndPortal() {
io.papermc.paper.util.TickThread.ensureTickThread(this, "Cannot portal entity async");
+ if (!this.level.kaiijuConfig.safeTeleporting && !(this instanceof net.minecraft.world.entity.player.Player)) return false; // Kaiiju - Unsafe teleportation
BlockPos pos = this.portalBlock;
ServerLevel world = this.portalWorld;
this.portalBlock = null;
diff --git a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
index 41d7cff39fc37955877668337689b4b26cd8c7cf..aee4ae51a73ac3c74bf4b3db23247b0eb45c2d7a 100644
--- a/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/EndPortalBlock.java
@@ -53,6 +53,13 @@ public class EndPortalBlock extends BaseEntityBlock {
// return; // CraftBukkit - always fire event in case plugins wish to change it
}
+ // Kaiiju start - Unsafe teleportation
+ if (!entity.level.kaiijuConfig.safeTeleporting && !(entity instanceof net.minecraft.world.entity.player.Player)) {
+ entity.endPortalLogicAsync();
+ return;
+ }
+ // Kaiiju end
+
// Paper start - move all of this logic into portal tick
entity.portalWorld = ((ServerLevel)world);
entity.portalBlock = pos.immutable();

View File

@@ -0,0 +1,48 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
Date: Sun, 28 May 2023 01:51:52 +0300
Subject: [PATCH] Toggle sand duplication
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
index bf23ddc5fdc274c9fc755f64d30d6792c9f4b0da..96f676cacbbb25e818d0f197c175a5f1179d3df9 100644
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuWorldConfig.java
@@ -153,6 +153,7 @@ public class KaiijuWorldConfig {
public boolean breakRedstoneOnTopOfTrapDoorsEarly = true;
public boolean fixTripWireStateInconsistency = true;
public boolean safeTeleporting = true;
+ public boolean sandDuplication = false;
private void gameplaySettings() {
shulkerBoxDropContentsWhenDestroyed = getBoolean("gameplay.shulker-box-drop-contents-when-destroyed", shulkerBoxDropContentsWhenDestroyed);
@@ -162,5 +163,6 @@ public class KaiijuWorldConfig {
breakRedstoneOnTopOfTrapDoorsEarly = getBoolean("gameplay.break-redstone-on-top-of-trap-doors-early", breakRedstoneOnTopOfTrapDoorsEarly);
fixTripWireStateInconsistency = getBoolean("gameplay.fix-tripwire-state-inconsistency", fixTripWireStateInconsistency);
safeTeleporting = getBoolean("gameplay.safe-teleportation", safeTeleporting);
+ sandDuplication = getBoolean("gameplay.sand-duplication", sandDuplication);
}
}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
index c8d125955754e27da54d95fb5b1cea39ca54b618..ffe82c153602babb679dee29d20e807a771a00ce 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -131,7 +131,7 @@ public class FallingBlockEntity extends Entity {
@Override
public void tick() {
// Paper start - fix sand duping
- if (this.isRemoved()) {
+ if (!this.level.kaiijuConfig.sandDuplication && this.isRemoved()) { // Kaiiju - Toggle sand duplication
return;
}
// Paper end - fix sand duping
@@ -148,7 +148,7 @@ public class FallingBlockEntity extends Entity {
this.move(MoverType.SELF, this.getDeltaMovement());
// Paper start - fix sand duping
- if (this.isRemoved()) {
+ if (!this.level.kaiijuConfig.sandDuplication && this.isRemoved()) { // Kaiiju - Toggle sand duplication
return;
}
// Paper end - fix sand duping

View File

@@ -0,0 +1,27 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Sofiane H. Djerbi" <46628754+kugge@users.noreply.github.com>
Date: Fri, 19 May 2023 03:38:03 +0300
Subject: [PATCH] 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 7875659b195e98b7e725e3daf8495d2efb1b5f88..92b2569ad58ddc0c192e4ee341c8040c3f872a53 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3914,10 +3914,15 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
(chunks) -> {
ServerLevel.makeObsidianPlatform(destination, null, targetPos);
+ // 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
);
}
);