-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed mixin to mixinextras ModifyReturnValue
- Loading branch information
1 parent
dcea46c
commit a769055
Showing
4 changed files
with
7 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip |
11 changes: 4 additions & 7 deletions
11
src/main/java/dev/latvian/mods/hdfont/mixin/AccessibilityOptionsScreenMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,19 @@ | ||
package dev.latvian.mods.hdfont.mixin; | ||
|
||
import com.llamalad7.mixinextras.injector.ModifyReturnValue; | ||
import dev.latvian.mods.hdfont.HDFontsClient; | ||
import net.minecraft.client.gui.screen.option.AccessibilityOptionsScreen; | ||
import net.minecraft.client.option.GameOptions; | ||
import net.minecraft.client.option.SimpleOption; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(AccessibilityOptionsScreen.class) | ||
public class AccessibilityOptionsScreenMixin { | ||
@Inject(method = "getOptions", at = @At("RETURN"), cancellable = true) | ||
private static void hdfont$getOptions(GameOptions gameOptions, CallbackInfoReturnable<SimpleOption<?>[]> cir) { | ||
var options = cir.getReturnValue(); | ||
@ModifyReturnValue(method = "getOptions", at = @At("RETURN")) | ||
private static SimpleOption<?>[] hdfont$getOptions(SimpleOption<?>[] options) { | ||
var newOptions = new SimpleOption<?>[options.length + 1]; | ||
System.arraycopy(options, 0, newOptions, 0, options.length); | ||
newOptions[options.length] = HDFontsClient.OPTION; | ||
cir.setReturnValue(newOptions); | ||
return newOptions; | ||
} | ||
} |