GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — added see invis, tho the opacity settings doesnt work yet · Intiiii/OneConfigExampleMod@6c8ffca

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src/main
    • java/org/inti/ares
      • AresMod.java
      • config
        • TestConfig.java
      • mixin
        • InvisiblePlayerMixin.java
    • resources
      • mixins.ares.json
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/main/java/org/inti/ares/AresMod.java‎

Copy file name to clipboardExpand all lines: src/main/java/org/inti/ares/AresMod.java
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import org.apache.logging.log4j.LogManager;
44
import org.apache.logging.log4j.Logger;
55
import org.inti.ares.config.TestConfig;
6-
import cc.polyfrost.oneconfig.events.event.InitializationEvent;
76
import net.minecraftforge.fml.common.Mod;
87
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
98
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
Collapse file

‎src/main/java/org/inti/ares/config/TestConfig.java‎

Copy file name to clipboardExpand all lines: src/main/java/org/inti/ares/config/TestConfig.java
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import org.inti.ares.AresMod;
44
import cc.polyfrost.oneconfig.config.Config;
55
import cc.polyfrost.oneconfig.config.annotations.Slider;
6+
import cc.polyfrost.oneconfig.config.annotations.Switch;
67
import cc.polyfrost.oneconfig.config.data.Mod;
78
import cc.polyfrost.oneconfig.config.data.ModType;
89

@@ -26,6 +27,20 @@ public class TestConfig extends Config {
2627
)
2728
public static float otherFootstepsVolume = 100f;
2829

30+
@Switch(
31+
name = "See Invisible Players",
32+
description = "Allows you to see players that are invisible"
33+
)
34+
public boolean seeInvisiblePlayers = false;
35+
36+
@Slider(
37+
name = "Invisible Player Opacity",
38+
description = "Opacity of invisible players when revealed",
39+
min = 0,
40+
max = 100
41+
)
42+
public float invisiblePlayerOpacity = 50;
43+
2944
public TestConfig() {
3045
super(new Mod(AresMod.MOD_ID, ModType.UTIL_QOL), AresMod.MOD_ID + ".json");
3146
initialize();
Collapse file

‎src/main/java/org/inti/ares/mixin/InvisiblePlayerMixin.java‎

Copy file name to clipboard
+30Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package org.inti.ares.mixin;
2+
3+
import net.minecraft.client.Minecraft;
4+
import net.minecraft.entity.Entity;
5+
import net.minecraft.entity.player.EntityPlayer;
6+
import org.inti.ares.AresMod;
7+
import org.spongepowered.asm.mixin.Mixin;
8+
import org.spongepowered.asm.mixin.injection.At;
9+
import org.spongepowered.asm.mixin.injection.Inject;
10+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
11+
12+
@Mixin(Entity.class)
13+
public abstract class InvisiblePlayerMixin {
14+
15+
@Inject(method = "isInvisible()Z", at = @At("HEAD"), cancellable = true)
16+
private void onIsInvisible(CallbackInfoReturnable<Boolean> cir) {
17+
if ((Object)this instanceof EntityPlayer) {
18+
EntityPlayer self = (EntityPlayer)(Object)this;
19+
20+
if (AresMod.config.seeInvisiblePlayers) {
21+
// If the player is the local player or another player in render distance
22+
if (self == Minecraft.getMinecraft().thePlayer ||
23+
Minecraft.getMinecraft().theWorld.playerEntities.contains(self)) {
24+
cir.setReturnValue(false);
25+
AresMod.LOGGER.info("Forcing player to be visible: " + self.getName());
26+
}
27+
}
28+
}
29+
}
30+
}
Collapse file

‎src/main/resources/mixins.ares.json‎

Copy file name to clipboardExpand all lines: src/main/resources/mixins.ares.json
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"maxShiftBy": 5
88
},
99
"mixins": [
10-
"SoundMixin"
10+
"SoundMixin",
11+
"InvisiblePlayerMixin"
1112
],
1213
"client": [],
1314
"verbose": true

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.