Skip to content

Commit 55ca970

Browse files
fix MC-159283 and MC-201723 (from Thorium) (#429)
* fix MC-159283 and MC-201723 (from Thorium) * add explanation and comment as to what this does. --------- Co-authored-by: isxander <xander@isxander.dev>
1 parent d35020c commit 55ca970

8 files changed

Lines changed: 85 additions & 1 deletion

File tree

PATCHED.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
| Basic | [MC-176559](https://bugs.mojang.com/browse/MC-176559) | Breaking process resets when a pickaxe enchanted with Mending mends by XP / Mending slows down breaking blocks again |
2626
| Basic | [MC-183776](https://bugs.mojang.com/browse/MC-183776) | After switching gamemodes using F3+F4, you need to press F3 twice to toggle the debug screen |
2727
| Basic | [MC-197260](https://bugs.mojang.com/browse/MC-197260) | Armor Stand renders itself and armor dark if its head is in a solid block |
28+
| Basic | [MC-201723](https://bugs.mojang.com/browse/MC-201723) | Statistics sprites don't look pressed when clicked |
2829
| Basic | [MC-206540](https://bugs.mojang.com/browse/MC-206540) | Increased input delay when riding an entity |
2930
| Basic | [MC-211561](https://bugs.mojang.com/browse/MC-211561) | Fishing line appears in opposite hand when switching slots |
3031
| Basic | [MC-215531](https://bugs.mojang.com/browse/MC-215531) | The carved pumpkin overlay isn't removed when switching into spectator mode |
@@ -56,6 +57,7 @@
5657
| Basic | [MC-129909](https://bugs.mojang.com/browse/MC-129909) | Players in spectator mode continue to consume foods and liquids shortly after switching game modes |
5758
| Basic | [MC-132878](https://bugs.mojang.com/browse/MC-132878) | Armor stands destroyed by explosions/lava/fire don't produce particles |
5859
| Basic | [MC-155509](https://bugs.mojang.com/browse/MC-155509) | Puffed pufferfish can hurt the player while dying |
60+
| Basic | [MC-159283](https://bugs.mojang.com/browse/MC-159283) | The End terrain does not generate in multiple rings centered around the world center |
5961
| Basic | [MC-160095](https://bugs.mojang.com/browse/MC-160095) | End Rods only break Cactus when moved by pistons |
6062
| Basic | [MC-170462](https://bugs.mojang.com/browse/MC-170462) | Bad Omen is considered a positive effect in potion item tooltips |
6163
| Basic | [MC-179072](https://bugs.mojang.com/browse/MC-179072) | Creepers do not defuse when switching from Survival to Creative/Spectator |

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ tasks.processResources {
109109
j-Tai's TieFix - Code used licensed under LGPLv3
110110
FlashyReese's Sodium Extra - Code used licensed under LGPLv3
111111
Ampflower's 2x2 Surrounded Saplings Fix - Code used licensed under Zlib
112+
NoahvdAa's Thorium - Code used licensed under LGPLv3
112113
""".trimIndent()
113114
inputs.property("version", project.version)
114115
inputs.property("description", modDescription)
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package dev.isxander.debugify.client.mixins.basic.mc201723;
2+
3+
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
4+
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
5+
import dev.isxander.debugify.fixes.BugFix;
6+
import dev.isxander.debugify.fixes.FixCategory;
7+
import net.minecraft.client.Minecraft;
8+
import net.minecraft.client.MouseHandler;
9+
import net.minecraft.client.gui.components.ObjectSelectionList;
10+
import net.minecraft.client.gui.screens.achievement.StatsScreen;
11+
import org.spongepowered.asm.mixin.Mixin;
12+
import org.spongepowered.asm.mixin.Shadow;
13+
import org.spongepowered.asm.mixin.injection.At;
14+
15+
/**
16+
* Taken from Thorium
17+
* https://github.com/PotassiumMC/thorium
18+
* under LGPLv3 license
19+
*
20+
* @author NoahvdAa
21+
*/
22+
@BugFix(id = "MC-201723", category = FixCategory.BASIC, env = BugFix.Env.CLIENT, description = "Statistics sprites don't look pressed when clicked")
23+
@Mixin(StatsScreen.ItemStatisticsList.class)
24+
public class StatsScreenMixin extends ObjectSelectionList {
25+
@Shadow
26+
protected int headerPressed;
27+
28+
public StatsScreenMixin(Minecraft minecraft, int i, int j, int k, int l) {
29+
super(minecraft, i, j, k, l);
30+
}
31+
32+
@WrapOperation(method = "renderHeader", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MouseHandler;isLeftPressed()Z"))
33+
private boolean forceLeftClick(MouseHandler instance, Operation<Boolean> original) {
34+
return true;
35+
}
36+
37+
@Override
38+
public boolean mouseReleased(double mouseX, double mouseY, int button) {
39+
if (button == 0) {
40+
this.headerPressed = -1;
41+
}
42+
43+
return super.mouseReleased(mouseX, mouseY, button);
44+
}
45+
}

src/client/resources/debugify.client.mixins.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"basic.mc183776.KeyboardHandlerMixin",
2121
"basic.mc197260.ArmorStandRendererMixin",
2222
"basic.mc197260.LivingEntityRendererMixin",
23+
"basic.mc201723.StatsScreenMixin",
2324
"basic.mc211561.FishingHookRendererMixin",
2425
"basic.mc215531.GuiMixin",
2526
"basic.mc217716.GameRendererMixin",
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package dev.isxander.debugify.mixins.basic.mc159283;
2+
3+
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
4+
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
5+
import dev.isxander.debugify.fixes.BugFix;
6+
import dev.isxander.debugify.fixes.FixCategory;
7+
import net.minecraft.util.Mth;
8+
import net.minecraft.world.level.levelgen.DensityFunctions;
9+
import net.minecraft.world.level.levelgen.synth.SimplexNoise;
10+
import org.spongepowered.asm.mixin.Mixin;
11+
import org.spongepowered.asm.mixin.injection.At;
12+
13+
/**
14+
* Taken from Thorium
15+
* https://github.com/PotassiumMC/thorium
16+
* under LGPLv3 license
17+
*
18+
* @author NoahvdAa
19+
*/
20+
@BugFix(id = "MC-159283", category = FixCategory.BASIC, env = BugFix.Env.SERVER, description = "The End terrain does not generate in multiple rings centered around the world center")
21+
@Mixin(DensityFunctions.EndIslandDensityFunction.class)
22+
public class DensityFunctionsMixin {
23+
/**
24+
* Explicitly cast `x` and `z` to long (from int) to prevent integer overflow when squaring
25+
*/
26+
@WrapOperation(method = "getHeightValue", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/Mth;sqrt(F)F", ordinal = 0))
27+
private static float castToLongs(float f, Operation<Float> original, SimplexNoise simplexNoise, int x, int z) {
28+
return Mth.sqrt((long) x * (long) x + (long) z * (long) z);
29+
}
30+
}

src/main/resources/assets/debugify/lang/en_us.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"debugify.fix_explanation.mc-197260": "Overrides the light level passed to the armour stand renderer with a maximum of: the block below the armor stand, bottom of the armor stand, top of the armor stand and the block above of the armor stand.",
5151
"debugify.fix_explanation.mc-237493": "Adds an option in the telemetry menu to completely disable telemetry. Telemetry is disabled by overriding all outgoing telemetry events to be an empty telemetry event, which is not sent.",
5252

53-
"debugify.fix_explanation.mc-2025": "Due to floating point inaccuracies, sometimes the hitbox of entities end up being slightly smaller than desired. Then, if this happens before the entities are pushed against eachother, they will intersect with the wall. Then, when the AABB is recalculated on chunk load, they will be determined as inside the wall, where they are then pushed. This fix simply writes an 'AABB' tag to entity NBT data with double-precision hitbox sizes which then get loaded back in.",
53+
"debugify.fix_explanation.mc-2025": "Due to floating point inaccuracies, sometimes the hitbox of entities end up being slightly smaller than desired. Then, if this happens before the entities are pushed against each-other, they will intersect with the wall. Then, when the AABB is recalculated on chunk load, they will be determined as inside the wall, where they are then pushed. This fix simply writes an 'AABB' tag to entity NBT data with double-precision hitbox sizes which then get loaded back in.",
5454
"debugify.fix_effect.mc-2025": "This fix means loading Debugify for the first time will not fix the issue until the chunks are saved and loaded with Debugify.",
5555
"debugify.fix_explanation.mc-7569": "Appends a new line to the end of every system message.",
5656
"debugify.fix_explanation.mc-30391": "Adds edge-case checks for chicken, blaze and the wither to fall damage spawn particles to not spawn them.",
@@ -68,6 +68,8 @@
6868
"debugify.fix_explanation.mc-132878": "Spawns breaking particles when armour stands are hurt.",
6969
"debugify.fix_explanation.mc-135971": "Overrides CTRL+Q behaviour in crafting slot to repeatedly CTRL+Q until there are no items left in the crafting slot.",
7070
"debugify.fix_explanation.mc-155509": "Checks if the pufferfish is alive before attempting to sting the player.",
71+
"debugify.fix_explanation.mc-159283": "Casts 32-bit integers to 64-bit equivalents to prevent integer overflow at high X and Z values.",
72+
"debugify.fix_effect.mc-159283": "Affects world generation.",
7173
"debugify.fix_explanation.mc-160095": "If cacti encounter a piston head, the block that is being moved by the piston is considered instead of the piston.",
7274
"debugify.fix_explanation.mc-179072": "Checks if the entity the creeper sees is an enemy before igniting.",
7375
"debugify.fix_explanation.mc-183990": "When a mob is ticked, it checks to see if its target is dead, and removes it if so. This fix also applies to a long list of entities that have group attacks, not just silverfish.",

src/main/resources/debugify.accesswidener

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ accessible class net/minecraft/client/Options$FieldAccess
44
#accessible method net/minecraft/client/Options$FieldAccess process (Ljava/lang/String;Lnet/minecraft/client/OptionInstance;)V
55
accessible class net/minecraft/client/gui/screens/telemetry/TelemetryEventWidget$ContentBuilder
66
accessible class net/minecraft/client/gui/screens/telemetry/TelemetryEventWidget$Content
7+
accessible class net/minecraft/client/gui/screens/achievement/StatsScreen$ItemStatisticsList
8+
accessible class net/minecraft/world/level/levelgen/DensityFunctions$EndIslandDensityFunction

src/main/resources/debugify.mixins.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"basic.mc129909.ServerPlayerMixin",
1818
"basic.mc132878.ArmorStandMixin",
1919
"basic.mc155509.PufferfishMixin",
20+
"basic.mc159283.DensityFunctionsMixin",
2021
"basic.mc160095.CactusBlockMixin",
2122
"basic.mc170462.MobEffectsMixin",
2223
"basic.mc179072.SwellGoalMixin",

0 commit comments

Comments
 (0)