-
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.
- Loading branch information
Showing
8 changed files
with
108 additions
and
0 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
28 changes: 28 additions & 0 deletions
28
src/main/java/mod/acgaming/universaltweaks/tweaks/snooper/mixin/UTSnooperClient.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,28 @@ | ||
package mod.acgaming.universaltweaks.tweaks.snooper.mixin; | ||
|
||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.settings.GameSettings; | ||
|
||
import mod.acgaming.universaltweaks.UniversalTweaks; | ||
import mod.acgaming.universaltweaks.config.UTConfig; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
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; | ||
|
||
@Mixin(Minecraft.class) | ||
public class UTSnooperClient | ||
{ | ||
@Shadow | ||
public GameSettings gameSettings; | ||
|
||
@Inject(method = "isSnooperEnabled", at = @At("HEAD"), cancellable = true) | ||
public void utSnooperClient(CallbackInfoReturnable<Boolean> cir) | ||
{ | ||
if (!UTConfig.TWEAKS_MISC.utSnooperToggle) return; | ||
if (UTConfig.DEBUG.utDebugToggle) UniversalTweaks.LOGGER.debug("UTSnooperClient ::: Disable client snooper"); | ||
this.gameSettings.snooperEnabled = false; | ||
cir.setReturnValue(false); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/mod/acgaming/universaltweaks/tweaks/snooper/mixin/UTSnooperClientButton.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,26 @@ | ||
package mod.acgaming.universaltweaks.tweaks.snooper.mixin; | ||
|
||
import net.minecraft.client.gui.GuiButton; | ||
import net.minecraft.client.gui.GuiOptions; | ||
import net.minecraft.client.gui.GuiScreen; | ||
import net.minecraft.client.resources.I18n; | ||
|
||
import mod.acgaming.universaltweaks.UniversalTweaks; | ||
import mod.acgaming.universaltweaks.config.UTConfig; | ||
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; | ||
|
||
@Mixin(GuiOptions.class) | ||
public class UTSnooperClientButton extends GuiScreen | ||
{ | ||
@Inject(method = "initGui", at = @At(value = "INVOKE", target = "Ljava/util/List;add(Ljava/lang/Object;)Z", ordinal = 12), cancellable = true) | ||
public void utRemoveSnooperButton(CallbackInfo ci) | ||
{ | ||
if (!UTConfig.TWEAKS_MISC.utSnooperToggle) return; | ||
if (UTConfig.DEBUG.utDebugToggle) UniversalTweaks.LOGGER.debug("UTSnooperClientButton ::: Init GUI"); | ||
this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 168, I18n.format("gui.done"))); | ||
ci.cancel(); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/mod/acgaming/universaltweaks/tweaks/snooper/mixin/UTSnooperServer.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,29 @@ | ||
package mod.acgaming.universaltweaks.tweaks.snooper.mixin; | ||
|
||
import net.minecraft.server.dedicated.DedicatedServer; | ||
import net.minecraft.server.dedicated.PropertyManager; | ||
|
||
import mod.acgaming.universaltweaks.UniversalTweaks; | ||
import mod.acgaming.universaltweaks.config.UTConfig; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
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; | ||
|
||
@Mixin(DedicatedServer.class) | ||
public class UTSnooperServer | ||
{ | ||
@Shadow | ||
private PropertyManager settings; | ||
|
||
@Inject(method = "isSnooperEnabled", at = @At("HEAD"), cancellable = true) | ||
public void utSnooperServer(CallbackInfoReturnable<Boolean> cir) | ||
{ | ||
if (!UTConfig.TWEAKS_MISC.utSnooperToggle) return; | ||
if (UTConfig.DEBUG.utDebugToggle) UniversalTweaks.LOGGER.debug("UTSnooperServer ::: Disable server snooper"); | ||
this.settings.getBooleanProperty("snooper-enabled", false); | ||
this.settings.setProperty("snooper-enabled", false); | ||
cir.setReturnValue(false); | ||
} | ||
} |
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,7 @@ | ||
{ | ||
"package": "mod.acgaming.universaltweaks.tweaks.snooper.mixin", | ||
"refmap": "universaltweaks.refmap.json", | ||
"minVersion": "0.8", | ||
"compatibilityLevel": "JAVA_8", | ||
"client": ["UTSnooperClient", "UTSnooperClientButton"] | ||
} |
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,7 @@ | ||
{ | ||
"package": "mod.acgaming.universaltweaks.tweaks.snooper.mixin", | ||
"refmap": "universaltweaks.refmap.json", | ||
"minVersion": "0.8", | ||
"compatibilityLevel": "JAVA_8", | ||
"mixins": ["UTSnooperServer"] | ||
} |