Skip to content

Commit df3ed97

Browse files
mist475Mist475
andauthored
Improve MixinRenderItem compatibility (#132)
* update buildscript * make MixinRenderItem apply on config, rather than check config during runtime - also use WrapOperation rather than Redirect --------- Co-authored-by: Mist475 <[email protected]>
1 parent f022d15 commit df3ed97

File tree

7 files changed

+29
-22
lines changed

7 files changed

+29
-22
lines changed

gradle.properties

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ accessTransformersFile = archaicfix_at.cfg
8585
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
8686
usesMixins = true
8787

88+
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
89+
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
90+
# Mixin classes will have access to "main" classes, but not the other way around.
91+
separateMixinSourceSet =
92+
8893
# Adds some debug arguments like verbose output and class export.
8994
usesMixinDebug = false
9095

@@ -117,9 +122,15 @@ minimizeShadowedDependencies = true
117122
# If disabled, won't rename the shadowed classes.
118123
relocateShadowedDependencies = true
119124

120-
# Adds the GTNH maven, CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
125+
# Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
121126
includeWellKnownRepositories = true
122127

128+
# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated
129+
# list of strings, with the acceptable keys being(case does not matter):
130+
# cursemaven
131+
# modrinth
132+
excludeWellKnownRepositories =
133+
123134
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
124135
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
125136
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.

gradle/wrapper/gradle-wrapper.jar

9 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew.bat

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
4343
%JAVA_EXE% -version >NUL 2>&1
4444
if %ERRORLEVEL% equ 0 goto execute
4545

46-
echo. 1>&2
47-
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
48-
echo. 1>&2
49-
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
50-
echo location of your Java installation. 1>&2
46+
echo.
47+
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
48+
echo.
49+
echo Please set the JAVA_HOME variable in your environment to match the
50+
echo location of your Java installation.
5151

5252
goto fail
5353

@@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
5757

5858
if exist "%JAVA_EXE%" goto execute
5959

60-
echo. 1>&2
61-
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
62-
echo. 1>&2
63-
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
64-
echo location of your Java installation. 1>&2
60+
echo.
61+
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
62+
echo.
63+
echo Please set the JAVA_HOME variable in your environment to match the
64+
echo location of your Java installation.
6565

6666
goto fail
6767

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pluginManagement {
3333
}
3434

3535
plugins {
36-
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.22'
36+
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.29'
3737
}
3838

3939

src/main/java/org/embeddedt/archaicfix/asm/Mixin.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import org.embeddedt.archaicfix.helpers.DragonAPIHelper;
88

99
import java.util.Collection;
10-
import java.util.List;
1110
import java.util.Locale;
1211
import java.util.function.Predicate;
1312

@@ -94,7 +93,7 @@ public enum Mixin {
9493
client_core_MixinNetHandlerLoginClient(Side.CLIENT, Phase.EARLY, m -> ArchaicConfig.fixLoginRaceCondition, "core.MixinNetHandlerLoginClient"),
9594
client_core_MixinSplashProgress(Side.CLIENT, Phase.EARLY, always(), "core.MixinSplashProgress"),
9695
client_core_AccessorSplashProgress(Side.CLIENT, Phase.EARLY, always(), "core.AccessorSplashProgress"),
97-
client_core_MixinRenderItem(Side.CLIENT, Phase.EARLY, always(), "core.MixinRenderItem"),
96+
client_core_MixinRenderItem(Side.CLIENT, Phase.EARLY, m -> ArchaicConfig.forceFancyItems, "core.MixinRenderItem"),
9897
client_divinerpg_MixinEntitySparkler(Side.CLIENT, Phase.LATE, require(TargetedMod.DIVINERPG), "divinerpg.MixinEntitySparkler"),
9998
client_gt6_MixinGT_API_Proxy_Client(Side.CLIENT, Phase.LATE, require(TargetedMod.GREGTECH6), "gt6.MixinGT_API_Proxy_Client"),
10099
client_lighting_MixinMinecraft(Side.CLIENT, Phase.EARLY, phosphor(), "lighting.MixinMinecraft"),
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
package org.embeddedt.archaicfix.mixins.client.core;
22

3+
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
4+
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
35
import net.minecraft.client.renderer.entity.RenderItem;
46
import net.minecraft.client.settings.GameSettings;
5-
import org.embeddedt.archaicfix.config.ArchaicConfig;
67
import org.spongepowered.asm.mixin.Mixin;
78
import org.spongepowered.asm.mixin.injection.At;
8-
import org.spongepowered.asm.mixin.injection.Redirect;
99

1010
@Mixin(RenderItem.class)
1111
public class MixinRenderItem {
12-
@Redirect(method = "renderDroppedItem(Lnet/minecraft/entity/item/EntityItem;Lnet/minecraft/util/IIcon;IFFFFI)V", at = @At(value = "FIELD", target = "Lnet/minecraft/client/settings/GameSettings;fancyGraphics:Z"))
13-
private boolean forceFancyGraphics(GameSettings settings) {
14-
if(ArchaicConfig.forceFancyItems)
12+
@WrapOperation(method = "renderDroppedItem(Lnet/minecraft/entity/item/EntityItem;Lnet/minecraft/util/IIcon;IFFFFI)V", at = @At(value = "FIELD", target = "Lnet/minecraft/client/settings/GameSettings;fancyGraphics:Z"))
13+
private boolean forceFancyGraphics(GameSettings settings, Operation<Boolean> original) {
1514
return true;
16-
else
17-
return settings.fancyGraphics;
1815
}
1916
}

0 commit comments

Comments
 (0)