Skip to content
This repository has been archived by the owner on May 30, 2022. It is now read-only.

Commit

Permalink
Handle gameSettings being null, fixes issues with Terrestria and poss…
Browse files Browse the repository at this point in the history
…ibly other mods.
  • Loading branch information
modmuss50 committed Mar 27, 2020
1 parent 2ee9358 commit f39aa9d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ fabric_asm_version=v2.0
zt_zip_version=1.14
slf4j_version=1.7.30

mod_version = 1.0.0-beta6
mod_version = 1.0.0-beta7-test1
maven_group = me.modmuss50
archives_base_name = optifabric
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package me.modmuss50.optifabric.mixin;

import net.minecraft.client.options.GameOptions;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Pseudo;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Pseudo
@Mixin(targets = "net.optifine.Config")
public class MixinOptifineConfig {

@Shadow
private static GameOptions gameSettings;

@SuppressWarnings({"InvalidMemberReference", "UnresolvedMixinReference"})
@Inject(method = {"isAnimatedTerrain", "isAnimatedTextures", "isSwampColors", "isRandomEntities", "isSmoothBiome", "isCustomColors", "isCustomSky", "isCustomFonts", "isShowCapes", "isConnectedTextures", "isNaturalTextures", "isEmissiveTextures", "isConnectedTexturesFancy", "isFastRender", "isTranslucentBlocksFancy", "isSmoothWorld", "isLazyChunkLoading", "isDynamicFov", "isAlternateBlocks", "isCustomItems", "isDynamicLights", "isDynamicLightsFast", "isCustomEntityModels", "isCustomGuis", "isSmoothFps", "isShowGlErrors"},
at = @At("HEAD"), cancellable = true, remap = false)
private static void isRandomEntities(CallbackInfoReturnable<Boolean> returnable) {
if (gameSettings == null) {
returnable.setReturnValue(false);
}
}

}
3 changes: 2 additions & 1 deletion src/main/resources/optifabric.optifine.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"mixins": [
"MixinReflectorClass",
"MixinScreen",
"MixinClientBuiltinResourcePackProvider"
"MixinClientBuiltinResourcePackProvider",
"MixinOptifineConfig"
],
"injectors": {
"defaultRequire": 1
Expand Down

0 comments on commit f39aa9d

Please sign in to comment.