9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00
Files
Leaf/leaf-archived-patches/removed/1.21.3/server/0093-Load-portal-destination-chunk-before-entity-teleport.patch
2025-06-29 23:39:55 +08:00

52 lines
3.0 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Martijn Muijsers <martijnmuijsers@live.nl>
Date: Sun, 25 Dec 2022 16:55:45 +0100
Subject: [PATCH] Load portal destination chunk before entity teleport
Removed since Gale 1.21.3, entity can teleport cross dimension since 1.21.1
also see 1.21.1 update in mc wiki for more info
License: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
Gale - https://galemc.org
This patch is based on the following patch:
"Load chunks when entities go through an end portal"
By: PureGero <puregero@gmail.com>
As part of: MultiPaper (https://github.com/MultiPaper/MultiPaper)
Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html)
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index ce11e73e7a91c9d45f62552ab1cd7bec47b2a879..4865759b5ad05997b7777a8cd036967083c2ef39 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4006,6 +4006,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
if (entity == null) {
return null;
} else {
+ // Gale start - MultiPaper - load portal destination chunk before entity teleport
+ if (world.galeConfig().gameplayMechanics.technical.loadPortalDestinationChunkBeforeEntityTeleport) {
+ BlockPos pos = BlockPos.containing(position);
+ world.getChunkSource().addRegionTicket(TicketType.PORTAL, new ChunkPos(pos), 1, pos);
+ world.getChunkAt(pos);
+ }
+ // Gale end - MultiPaper - load portal destination chunk before entity teleport
// Paper start - Fix item duplication and teleport issues
if (this instanceof Leashable leashable) {
leashable.dropLeash(true, true); // Paper drop lead
diff --git a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
index ecd4cf29a03d6f4ee71450b1c0d952209e40be4a..63ff60f9d5d9a8a5ea36754dd394696b54082d93 100644
--- a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
+++ b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java
@@ -119,6 +119,11 @@ public class GaleWorldConfiguration extends ConfigurationPart {
}
+ public Technical technical;
+ public class Technical extends ConfigurationPart {
+ public boolean loadPortalDestinationChunkBeforeEntityTeleport = false; // Gale - MultiPaper - load portal destination chunk before entity teleport
+ }
+
public boolean arrowMovementResetsDespawnCounter = true; // Gale - Purpur - make arrow movement resetting despawn counter configurable
public double entityWakeUpDurationRatioStandardDeviation = 0.2; // Gale - variable entity wake-up duration
public boolean hideFlamesOnEntitiesWithFireResistance = false; // Gale - Slice - hide flames on entities with fire resistance