Skip to content

Commit 3a190a5

Browse files
committed
Add optional fix for modern ender dragon having broken movement compared to 1.13
1 parent 6bfe079 commit 3a190a5

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package org.embeddedt.modernfix.common.mixin.bugfix.restore_old_dragon_movement;
2+
3+
import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
4+
import org.spongepowered.asm.mixin.Mixin;
5+
import org.spongepowered.asm.mixin.injection.At;
6+
import org.spongepowered.asm.mixin.injection.ModifyArg;
7+
import org.spongepowered.asm.mixin.injection.Slice;
8+
9+
@Mixin(EnderDragon.class)
10+
public class EnderDragonMixin {
11+
/**
12+
* @author embeddedt (regression identified by Jukitsu in MC-272431)
13+
* @reason Revert dragon vertical movement behavior to how it worked in 1.13 and older. Note: this patches techniques
14+
* that rely on the predictable vertical descent like one-cycling.
15+
*/
16+
@ModifyArg(method = "aiStep",
17+
slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/boss/enderdragon/phases/DragonPhaseInstance;getFlyTargetLocation()Lnet/minecraft/world/phys/Vec3;")),
18+
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/phys/Vec3;add(DDD)Lnet/minecraft/world/phys/Vec3;", ordinal = 0), index = 1)
19+
private double fixVerticalVelocityScale(double y) {
20+
return y * 10;
21+
}
22+
}

common/src/main/java/org/embeddedt/modernfix/core/config/ModernFixEarlyConfig.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ public DefaultSettingMapBuilder put(String key, Boolean value) {
170170
.put("mixin.perf.reuse_datapacks", false)
171171
.put("mixin.feature.direct_stack_trace", false)
172172
.put("mixin.feature.stalled_chunk_load_detection", false)
173+
.put("mixin.bugfix.restore_old_dragon_movement", false)
173174
.put("mixin.perf.clear_mixin_classinfo", false)
174175
.put("mixin.bugfix.packet_leak", false)
175176
.put("mixin.perf.deduplicate_location", false)

common/src/main/resources/assets/modernfix/lang/en_us.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,5 +131,6 @@
131131
"modernfix.option.mixin.feature.stalled_chunk_load_detection": "This option may help to detect the cause of chunkloading freezes. However, leaving it enabled may cause slightly worse performance.",
132132
"modernfix.option.mixin.perf.fix_loop_spin_waiting": "Fixes Minecraft's built-in wait function consuming excessive amounts of CPU resources.",
133133
"modernfix.option.mixin.perf.forge_cap_retrieval": "Small micro-optimization that makes retrieving custom entity data slightly more efficient on Forge.",
134-
"modernfix.option.mixin.perf.forge_registry_lambda": "Fixes oversights in Forge that lead to excessive allocation in hot registry methods."
134+
"modernfix.option.mixin.perf.forge_registry_lambda": "Fixes oversights in Forge that lead to excessive allocation in hot registry methods.",
135+
"modernfix.option.mixin.bugfix.restore_old_dragon_movement": "Fixes MC-272431, which tracks the ender dragon being unable to dive to the portal as it did in 1.13 and older. This causes the dragon to fly quite a bit differently from what modern players are used to and also patches out one-cycling, so it's not enabled by default. Thanks to Jukitsu for identifying the regression in the vanilla code."
135136
}

0 commit comments

Comments
 (0)