-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use mixins instead of mutating the setting field
- Loading branch information
Showing
5 changed files
with
57 additions
and
25 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
common/src/main/java/xaeroplus/mixin/client/MixinCommonInternet.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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package xaeroplus.mixin.client; | ||
|
||
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.CallbackInfo; | ||
import xaero.common.AXaeroMinimap; | ||
import xaero.common.misc.Internet; | ||
import xaeroplus.settings.XaeroPlusSettingRegistry; | ||
|
||
@Mixin(value = Internet.class, remap = false) | ||
public class MixinCommonInternet { | ||
|
||
@Inject(method = "checkModVersion", at = @At("HEAD"), cancellable = true, remap = false) | ||
private static void disableInternetAccessCheck(final AXaeroMinimap modMain, final CallbackInfo ci) { | ||
if (XaeroPlusSettingRegistry.disableXaeroInternetAccess.getValue()) ci.cancel(); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
common/src/main/java/xaeroplus/mixin/client/MixinPatreon.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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package xaeroplus.mixin.client; | ||
|
||
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.CallbackInfo; | ||
import xaero.common.patreon.Patreon; | ||
import xaeroplus.settings.XaeroPlusSettingRegistry; | ||
|
||
@Mixin(value = Patreon.class, remap = false) | ||
public class MixinPatreon { | ||
|
||
@Inject(method = "checkPatreon(Lxaero/common/AXaeroMinimap;)V", at = @At("HEAD"), cancellable = true) | ||
private static void disableInternetAccessCheck(final CallbackInfo ci) { | ||
if (XaeroPlusSettingRegistry.disableXaeroInternetAccess.getValue()) ci.cancel(); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
common/src/main/java/xaeroplus/mixin/client/MixinWorldMapInternet.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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package xaeroplus.mixin.client; | ||
|
||
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.CallbackInfo; | ||
import xaero.map.misc.Internet; | ||
import xaeroplus.settings.XaeroPlusSettingRegistry; | ||
|
||
@Mixin(value = Internet.class, remap = false) | ||
public class MixinWorldMapInternet { | ||
|
||
@Inject(method = "checkModVersion", at = @At("HEAD"), cancellable = true) | ||
private static void disableInternetAccessCheck(final CallbackInfo ci) { | ||
if (XaeroPlusSettingRegistry.disableXaeroInternetAccess.getValue()) ci.cancel(); | ||
} | ||
} |
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