Skip to content

Commit

Permalink
Changed mixin to mixinextras ModifyReturnValue
Browse files Browse the repository at this point in the history
  • Loading branch information
LatvianModder committed May 7, 2024
1 parent dcea46c commit a769055
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import java.time.Instant

plugins {
id 'fabric-loom' version '1.4-SNAPSHOT'
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'maven-publish'
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ org.gradle.daemon=false
minecraft_version=1.20.1
yarn_mappings=1.20.1+build.10
fabric_version=0.86.1+1.20.1
loader_version=0.14.22
loader_version=0.15.11
# Mod Properties
mod_version=2001.1.0
maven_group=dev.latvian.mods
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
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
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;
}
}

0 comments on commit a769055

Please sign in to comment.