mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-29 20:09:23 +00:00
feat: old ender dragon part can use end portal(#517)
This commit is contained in:
@@ -5,10 +5,10 @@ Subject: [PATCH] Add fakeplayer api
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index c9ea6559f809a6732588b8908001807be3d91196..fe30de1f0a7fc7112466b6eb2e5813f39259c3b6 100644
|
||||
index 3bde4ad79ade5aae18e9073307f637717e8dd9e3..9971ed1347f0f37800911c6cd9d0f8ae1a4f100c 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -3007,4 +3007,15 @@ public final class Bukkit {
|
||||
@@ -3016,4 +3016,15 @@ public final class Bukkit {
|
||||
public static void restart() {
|
||||
server.restart();
|
||||
}
|
||||
@@ -25,10 +25,10 @@ index c9ea6559f809a6732588b8908001807be3d91196..fe30de1f0a7fc7112466b6eb2e5813f3
|
||||
+ // Leaves end - Bot API
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index ed899c4cb4b5261ceff56bbc9ca806e20904508e..a5370832380e93cf029588caeb8e29e03cc52db8 100644
|
||||
index 9bab00ab10c78908090c8a1a12d4c84e9324b08b..3e7aad4ddf573f7c868b7824c4f0f34fa08cb1fe 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -2716,4 +2716,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@@ -2723,4 +2723,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
*/
|
||||
void allowPausing(@NotNull org.bukkit.plugin.Plugin plugin, boolean value);
|
||||
// Paper end - API to check if the server is sleeping
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Replay Mod API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index fe30de1f0a7fc7112466b6eb2e5813f39259c3b6..23f3ab31bbc9d197f9a82f4ed5003e6de814fad7 100644
|
||||
index 9971ed1347f0f37800911c6cd9d0f8ae1a4f100c..803611b793daed2d51ef6ab34d01fc8b0a3ecd23 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -3018,4 +3018,10 @@ public final class Bukkit {
|
||||
@@ -3027,4 +3027,10 @@ public final class Bukkit {
|
||||
return server.getBotManager();
|
||||
}
|
||||
// Leaves end - Bot API
|
||||
@@ -20,10 +20,10 @@ index fe30de1f0a7fc7112466b6eb2e5813f39259c3b6..23f3ab31bbc9d197f9a82f4ed5003e6d
|
||||
+ // Leaves end - Photographer API
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index a5370832380e93cf029588caeb8e29e03cc52db8..2531e82464e54e0c1b707e7c5a62ff0fd5ed8637 100644
|
||||
index 3e7aad4ddf573f7c868b7824c4f0f34fa08cb1fe..ce128dd8120b75884cb208d7ba7d316ee110333b 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -2725,4 +2725,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@@ -2732,4 +2732,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
*/
|
||||
@NotNull org.leavesmc.leaves.entity.BotManager getBotManager();
|
||||
// Leaves end - Bot API
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Bytebuf API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 23f3ab31bbc9d197f9a82f4ed5003e6de814fad7..30488f80b98d1dba485e53601edb5cb0e23b7591 100644
|
||||
index 803611b793daed2d51ef6ab34d01fc8b0a3ecd23..0149af5bd4234f925e12d78251766be5a16e5060 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -3024,4 +3024,10 @@ public final class Bukkit {
|
||||
@@ -3033,4 +3033,10 @@ public final class Bukkit {
|
||||
return server.getPhotographerManager();
|
||||
}
|
||||
// Leaves end - Photographer API
|
||||
@@ -20,10 +20,10 @@ index 23f3ab31bbc9d197f9a82f4ed5003e6de814fad7..30488f80b98d1dba485e53601edb5cb0
|
||||
+ // Leaves end - Bytebuf API
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index 2531e82464e54e0c1b707e7c5a62ff0fd5ed8637..a1742e64232c949dc88deb5d6083c4bf62e6aae9 100644
|
||||
index ce128dd8120b75884cb208d7ba7d316ee110333b..e63fb4e0c55929f2721e16f69e0c0a4b455477fa 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -2729,4 +2729,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@@ -2736,4 +2736,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
// Leaves start - Photographer API
|
||||
@NotNull org.leavesmc.leaves.entity.PhotographerManager getPhotographerManager();
|
||||
// Leaves end - Photographer API
|
||||
@@ -33,10 +33,10 @@ index 2531e82464e54e0c1b707e7c5a62ff0fd5ed8637..a1742e64232c949dc88deb5d6083c4bf
|
||||
+ // Leaves end - Bytebuf API
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index d34419693fc78b3f7e8f6bbf115f17f29e5e3377..ab45edbc10398d92ddfcfd16d12d49f5b4e87c4c 100644
|
||||
index 3584ca0a89f59e391ab6d5be8f2274a6801d025f..4171ac88c491c071af9def920084292e108587f0 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -3860,6 +3860,12 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
@@ -3859,6 +3859,12 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
|
||||
boolean isChunkSent(long chunkKey);
|
||||
// Paper end
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Leaves Config API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 30488f80b98d1dba485e53601edb5cb0e23b7591..91fa30c1713795007faef73280713a33d2518487 100644
|
||||
index 0149af5bd4234f925e12d78251766be5a16e5060..3c019280bc751e0710f1d34478b56986bc6000fc 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -3030,4 +3030,10 @@ public final class Bukkit {
|
||||
@@ -3039,4 +3039,10 @@ public final class Bukkit {
|
||||
return server.getBytebufManager();
|
||||
}
|
||||
// Leaves end - Bytebuf API
|
||||
@@ -20,10 +20,10 @@ index 30488f80b98d1dba485e53601edb5cb0e23b7591..91fa30c1713795007faef73280713a33
|
||||
+ // Leaves end - Config API
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
|
||||
index a1742e64232c949dc88deb5d6083c4bf62e6aae9..75a1917d998bf8aa0b86a67ca0f0836804fad012 100644
|
||||
index e63fb4e0c55929f2721e16f69e0c0a4b455477fa..37ff5eabaf0fd3ab72eb37a1f21904b5a1adebe0 100644
|
||||
--- a/src/main/java/org/bukkit/Server.java
|
||||
+++ b/src/main/java/org/bukkit/Server.java
|
||||
@@ -2733,4 +2733,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
@@ -2740,4 +2740,8 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
||||
// Leaves start - Bytebuf API
|
||||
org.leavesmc.leaves.bytebuf.BytebufManager getBytebufManager();
|
||||
// Leaves end - Bytebuf API
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MC_XiaoHei <xor7xiaohei@gmail.com>
|
||||
Date: Sun, 6 Jul 2025 10:32:36 +0800
|
||||
Subject: [PATCH] Old ender dragon part can use end portal
|
||||
|
||||
This patch is Powered by CrystalCarpetAddition(https://github.com/Crystal0404/CrystalCarpetAddition)
|
||||
|
||||
/*
|
||||
* This file is part of the Crystal Carpet Addition project, licensed under the
|
||||
* GNU General Public License v3.0
|
||||
*
|
||||
* Copyright (C) 2024 Crystal0404 and contributors
|
||||
*
|
||||
* Crystal Carpet Addition is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Crystal Carpet Addition is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Crystal Carpet Addition. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index 6e7033ceb43acf8afd4c27a4d130e8a3dd8c1eef..1b13e7bc16f0e13e8c7bdb3b4b744c83227e82f2 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -185,7 +185,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
// Paper end - Share random for entities to make them more random
|
||||
public @Nullable org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason; // Paper - Entity#getEntitySpawnReason
|
||||
|
||||
- private volatile @Nullable org.bukkit.craftbukkit.entity.CraftEntity bukkitEntity; // Paper - Folia schedulers - volatile
|
||||
+ public volatile @Nullable org.bukkit.craftbukkit.entity.CraftEntity bukkitEntity; // Paper - Folia schedulers - volatile // Leaves - private -> public
|
||||
public boolean collisionLoadChunks = false; // Paper
|
||||
|
||||
public org.bukkit.craftbukkit.entity.CraftEntity getBukkitEntity() {
|
||||
@@ -3956,7 +3956,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@Nullable
|
||||
public Entity teleport(TeleportTransition teleportTransition) {
|
||||
// Paper start - Fix item duplication and teleport issues
|
||||
- if ((!this.isAlive() || !this.valid) && (teleportTransition.newLevel() != this.level)) {
|
||||
+ if (!(org.leavesmc.leaves.LeavesConfig.modify.oldMC.enderDragonPartCanUseEndPortal && this instanceof net.minecraft.world.entity.boss.EnderDragonPart)) if ((!this.isAlive() || !this.valid) && (teleportTransition.newLevel() != this.level)) { // Leaves - endDragonPartCanUseEndPortal
|
||||
LOGGER.warn("Illegal Entity Teleport {} to {}:{}", this, teleportTransition.newLevel(), teleportTransition.position(), new Throwable());
|
||||
return null;
|
||||
}
|
||||
@@ -4072,7 +4072,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
entityx.restoreFrom(this);
|
||||
this.removeAfterChangingDimensions();
|
||||
entityx.teleportSetPosition(PositionMoveRotation.of(teleportTransition), teleportTransition.relatives());
|
||||
- if (this.inWorld) newLevel.addDuringTeleport(entityx); // CraftBukkit - Don't spawn the new entity if the current entity isn't spawned
|
||||
+ if (this.inWorld || (org.leavesmc.leaves.LeavesConfig.modify.oldMC.enderDragonPartCanUseEndPortal && this instanceof net.minecraft.world.entity.boss.EnderDragonPart)) newLevel.addDuringTeleport(entityx); // CraftBukkit - Don't spawn the new entity if the current entity isn't spawned // Leaves - endDragonPartCanUseEndPortal
|
||||
|
||||
for (Entity entity2 : list) {
|
||||
entity2.startRiding(entityx, true);
|
||||
@@ -4207,6 +4207,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
|
||||
public boolean canTeleport(Level fromLevel, Level toLevel) {
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.modify.oldMC.enderDragonPartCanUseEndPortal && this instanceof net.minecraft.world.entity.boss.EnderDragonPart) return true; // Leaves - enderDragonPartCanUseEndPortal
|
||||
if (!org.leavesmc.leaves.LeavesConfig.modify.oldMC.allowEntityPortalWithPassenger && (this.isPassenger() || this.isVehicle())) return false; // Leaves - allowEntityPortalWithPassenger
|
||||
if (!this.isAlive() || !this.valid) return false; // Paper - Fix item duplication and teleport issues
|
||||
if (fromLevel.dimension() == Level.END && toLevel.dimension() == Level.OVERWORLD) {
|
||||
diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java
|
||||
index c05803a72b5db05f9a0b6119b57f665a25e1277a..3f0077d2f1486bfac30d8161f7cc43bf719b1777 100644
|
||||
--- a/net/minecraft/world/entity/Mob.java
|
||||
+++ b/net/minecraft/world/entity/Mob.java
|
||||
@@ -384,6 +384,16 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
if (!this.level().isClientSide && this.tickCount % 5 == 0) {
|
||||
this.updateControlFlags();
|
||||
}
|
||||
+ // Leaves start - ender dragon part can use end portal
|
||||
+ if (!org.leavesmc.leaves.LeavesConfig.modify.oldMC.enderDragonPartCanUseEndPortal) return;
|
||||
+ if (!(this instanceof net.minecraft.world.entity.boss.enderdragon.EnderDragon dragon)) return;
|
||||
+ for (net.minecraft.world.entity.boss.EnderDragonPart part : dragon.getSubEntities()) {
|
||||
+ PortalProcessor portalManager = part.portalProcess;
|
||||
+ if (portalManager == null) continue;
|
||||
+ if (!(portalManager.portal instanceof net.minecraft.world.level.block.EndPortalBlock)) continue;
|
||||
+ part.handlePortal();
|
||||
+ }
|
||||
+ // Leaves end - ender dragon part can use end portal
|
||||
}
|
||||
|
||||
protected void updateControlFlags() {
|
||||
diff --git a/net/minecraft/world/entity/PortalProcessor.java b/net/minecraft/world/entity/PortalProcessor.java
|
||||
index 88b07fbb96b20124777889830afa480673629d43..250c43fb38e2aabd0b58ef44c477f07eee48bce7 100644
|
||||
--- a/net/minecraft/world/entity/PortalProcessor.java
|
||||
+++ b/net/minecraft/world/entity/PortalProcessor.java
|
||||
@@ -7,7 +7,7 @@ import net.minecraft.world.level.block.Portal;
|
||||
import net.minecraft.world.level.portal.TeleportTransition;
|
||||
|
||||
public class PortalProcessor {
|
||||
- private final Portal portal;
|
||||
+ public final Portal portal; // Leaves - private -> public
|
||||
private BlockPos entryPosition;
|
||||
private int portalTime;
|
||||
private boolean insidePortalThisTick;
|
||||
@@ -0,0 +1,35 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MC_XiaoHei <xor7xiaohei@gmail.com>
|
||||
Date: Sun, 6 Jul 2025 13:10:13 +0800
|
||||
Subject: [PATCH] Old ender dragon part can use end portal
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexPart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexPart.java
|
||||
index 178cadf023bf516b93625c124fbf1a06b0131c58..8151542d59ceb5e135571928d2e203170f3a9ea6 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexPart.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexPart.java
|
||||
@@ -12,14 +12,19 @@ public class CraftComplexPart extends CraftEntity implements ComplexEntityPart {
|
||||
super(server, entity);
|
||||
}
|
||||
|
||||
- @Override
|
||||
- public EnderDragonPart getHandle() {
|
||||
- return (EnderDragonPart) this.entity;
|
||||
- }
|
||||
+ // @Override // Leaves start - endDragonPartCanUseEndPortal
|
||||
+ // public EnderDragonPart getHandle() {
|
||||
+ // return (EnderDragonPart) this.entity;
|
||||
+ // }
|
||||
|
||||
@Override
|
||||
public ComplexLivingEntity getParent() {
|
||||
- return (ComplexLivingEntity) this.getHandle().parentMob.getBukkitEntity();
|
||||
+ net.minecraft.world.entity.Entity entity = this.getHandle();
|
||||
+ if (entity instanceof EnderDragonPart part) return (ComplexLivingEntity) part.parentMob.getBukkitEntity();
|
||||
+ CraftEnderDragon dragon = new org.bukkit.craftbukkit.entity.CraftEnderDragon((org.bukkit.craftbukkit.CraftServer) org.bukkit.Bukkit.getServer(), (net.minecraft.world.entity.boss.enderdragon.EnderDragon) entity);
|
||||
+ entity.bukkitEntity = dragon;
|
||||
+ return dragon;
|
||||
+ // Leaves end - endDragonPartCanUseEndPortal
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -358,6 +358,9 @@ public final class LeavesConfig {
|
||||
|
||||
@GlobalConfig("old-projectile-explosion-behavior")
|
||||
public boolean oldProjectileExplosionBehavior = false;
|
||||
|
||||
@GlobalConfig("ender-dragon-part-can-use-end-portal")
|
||||
public boolean enderDragonPartCanUseEndPortal = false;
|
||||
}
|
||||
|
||||
public ElytraAeronauticsConfig elytraAeronautics = new ElytraAeronauticsConfig();
|
||||
|
||||
Reference in New Issue
Block a user