Skip to content

Commit e54495e

Browse files
committed
Port Descend plugin
1 parent 1ae6b73 commit e54495e

File tree

3 files changed

+91
-0
lines changed

3 files changed

+91
-0
lines changed

atdeprecated-server/minecraft-patches/features/0003-Dispenser-place-boat-on-ice-packed-ice-blue-ice.patch

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Date: Sat, 19 Jul 2025 22:20:58 +0700
44
Subject: [PATCH] Dispenser place boat on ice, packed ice, blue ice
55

66

7+
As part of: MidnightPatch (https://github.com/MidnightTale/MidnightPatch/blob/eda1116de584d17c9d5b79b5151ff18a533595d5/src/main/java/fun/mntale/midnightPatch/module/entity/boat/DispenserBoatListener.java)
8+
79
diff --git a/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java b/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java
810
index 702ca443a746d733ef14e927b7377aa3d31ae61d..5f2394111e537d25da6a53d43cad23f1aecc17d2 100644
911
--- a/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java

atdeprecated-server/minecraft-patches/features/0007-Purpur-Barrels-and-enderchests-6-rows.patch

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ From: MidnightTale <[email protected]>
33
Date: Sun, 20 Jul 2025 08:35:18 +0700
44
Subject: [PATCH] Purpur: Barrels and enderchests 6 rows
55

6+
67
Co-authored by: William Blake Galbreath <[email protected]>
78
As part of: Purpur (https://github.com/PurpurMC/Purpur/blob/09f547de09fc5d886f18f6d99ff389289766ec9d/purpur-server/minecraft-patches/features/0003-Barrels-and-enderchests-6-rows.patch)
89
Licensed under: MIT (https://github.com/PurpurMC/Purpur/blob/09f547de09fc5d886f18f6d99ff389289766ec9d/LICENSE)
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: MidnightTale <[email protected]>
3+
Date: Mon, 21 Jul 2025 17:02:07 +0700
4+
Subject: [PATCH] Native Void Descend Gamerule
5+
6+
7+
As part of: Descend (https://github.com/MidnightTale/Descend/blob/26dc4dca932e7315fca5fed22ae4aa01ae765803/src/main/java/fun/mntale/descend/Descend.java)
8+
9+
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
10+
index d55a6989fd68f0bcf7bd05e9420fda1115afa6c0..c9722df404a6df65fa2f42a7eee50f5cf0775667 100644
11+
--- a/net/minecraft/world/entity/LivingEntity.java
12+
+++ b/net/minecraft/world/entity/LivingEntity.java
13+
@@ -2734,8 +2734,60 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
14+
15+
@Override
16+
protected void onBelowWorld() {
17+
- this.hurt(this.damageSources().fellOutOfWorld(), this.level().getWorld().getVoidDamageAmount()); // Paper - use configured void damage amount
18+
+ // atDeprecated start
19+
+ if (!this.voidDescendIfEnabled()) {
20+
+ this.hurt(this.damageSources().fellOutOfWorld(), ((ServerLevel) this.level()).getWorld().getVoidDamageAmount());
21+
+ }
22+
+ // atDeprecated end
23+
+ }
24+
+
25+
+ // atDeprecated start
26+
+ /**
27+
+ * Custom void descend logic, called from onBelowWorld().
28+
+ * Returns true if custom logic handled the event, false to fall back to vanilla.
29+
+ */
30+
+ public boolean voidDescendIfEnabled() {
31+
+ ServerLevel level = (ServerLevel) this.level();
32+
+ if (!level.getGameRules().getBoolean(net.minecraft.world.level.GameRules.VOID_DESCEND_ENABLED)) {
33+
+ return false;
34+
+ }
35+
+ double x = this.getX();
36+
+ double z = this.getZ();
37+
+ ServerLevel targetWorld = level;
38+
+ double targetY;
39+
+ ResourceKey<Level> dim = level.dimension();
40+
+ if (dim == net.minecraft.world.level.Level.OVERWORLD) {
41+
+ targetY = 320;
42+
+ } else if (dim == net.minecraft.world.level.Level.NETHER) {
43+
+ targetY = 128;
44+
+ } else if (dim == net.minecraft.world.level.Level.END) {
45+
+ targetWorld = level.getServer().overworld();
46+
+ targetY = 640;
47+
+ } else {
48+
+ targetY = 320;
49+
+ }
50+
+ level.sendParticles(net.minecraft.core.particles.ParticleTypes.PORTAL, x, this.getY(), z, 100, 1, 1, 1, 0.1);
51+
+ level.playSound(null, x, this.getY(), z, net.minecraft.sounds.SoundEvents.PORTAL_TRIGGER, net.minecraft.sounds.SoundSource.BLOCKS, 0.5f, 0.7f);
52+
+ final ServerLevel finalTargetWorld = targetWorld;
53+
+ final double finalTargetY = targetY;
54+
+ this.teleportAsync(
55+
+ finalTargetWorld,
56+
+ new net.minecraft.world.phys.Vec3(x, finalTargetY, z),
57+
+ this.getYRot(),
58+
+ this.getXRot(),
59+
+ this.getDeltaMovement(),
60+
+ org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.PLUGIN,
61+
+ Entity.TELEPORT_FLAG_LOAD_CHUNK | Entity.TELEPORT_FLAG_TELEPORT_PASSENGERS,
62+
+ (entity) -> {
63+
+ finalTargetWorld.sendParticles(net.minecraft.core.particles.ParticleTypes.PORTAL, x, finalTargetY, z, 100, 1, 1, 1, 0.1);
64+
+ finalTargetWorld.playSound(null, x, finalTargetY, z, net.minecraft.sounds.SoundEvents.PORTAL_TRIGGER, net.minecraft.sounds.SoundSource.BLOCKS, 0.3f, 0.4f);
65+
+ this.addEffect(new net.minecraft.world.effect.MobEffectInstance(net.minecraft.world.effect.MobEffects.SLOW_FALLING, 10 * 20, 0, true, true, true));
66+
+ this.addEffect(new net.minecraft.world.effect.MobEffectInstance(net.minecraft.world.effect.MobEffects.BLINDNESS, 7 * 20, 0, true, true, true));
67+
+ }
68+
+ );
69+
+ return true;
70+
}
71+
+ // atDeprecated end
72+
73+
protected void updateSwingTime() {
74+
if (!this.swinging && this.swingTime == 0) return; // Leaf - Lithium - entity.fast_hand_swing
75+
diff --git a/net/minecraft/world/level/GameRules.java b/net/minecraft/world/level/GameRules.java
76+
index a6277c587f9e3bdae3b00d2862dea7f4c06253bd..1c1e39b7cdf9c05503192101c5aff9547eda2232 100644
77+
--- a/net/minecraft/world/level/GameRules.java
78+
+++ b/net/minecraft/world/level/GameRules.java
79+
@@ -262,6 +262,9 @@ public class GameRules {
80+
public static final GameRules.Key<GameRules.IntegerValue> RULE_DEATH_XP_DROP_PERCENTAGE = register(
81+
"deathXpDropPercentage", GameRules.Category.PLAYER, GameRules.IntegerValue.create(70, 0, 100, FeatureFlagSet.of(), (server, value) -> {})
82+
);
83+
+ public static final GameRules.Key<GameRules.BooleanValue> VOID_DESCEND_ENABLED = register(
84+
+ "voidDescendEnabled", GameRules.Category.PLAYER, GameRules.BooleanValue.create(true)
85+
+ );
86+
// atDeprecated end
87+
private final Map<GameRules.Key<?>, GameRules.Value<?>> rules;
88+
private final FeatureFlagSet enabledFeatures;

0 commit comments

Comments
 (0)