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
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: src/main/java/org/inti/ares/AresMod.java -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
|
3 | 3 | import org.apache.logging.log4j.LogManager; |
4 | 4 | import org.apache.logging.log4j.Logger; |
5 | 5 | import org.inti.ares.config.TestConfig; |
6 | | -import cc.polyfrost.oneconfig.events.event.InitializationEvent; |
7 | 6 | import net.minecraftforge.fml.common.Mod; |
8 | 7 | import net.minecraftforge.fml.common.event.FMLInitializationEvent; |
9 | 8 | import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; |
|
Collapse file
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 number | Diff line number | Diff line change |
|---|
|
3 | 3 | import org.inti.ares.AresMod; |
4 | 4 | import cc.polyfrost.oneconfig.config.Config; |
5 | 5 | import cc.polyfrost.oneconfig.config.annotations.Slider; |
| 6 | +import cc.polyfrost.oneconfig.config.annotations.Switch; |
6 | 7 | import cc.polyfrost.oneconfig.config.data.Mod; |
7 | 8 | import cc.polyfrost.oneconfig.config.data.ModType; |
8 | 9 |
|
@@ -26,6 +27,20 @@ public class TestConfig extends Config { |
26 | 27 | ) |
27 | 28 | public static float otherFootstepsVolume = 100f; |
28 | 29 |
|
| 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 | + |
29 | 44 | public TestConfig() { |
30 | 45 | super(new Mod(AresMod.MOD_ID, ModType.UTIL_QOL), AresMod.MOD_ID + ".json"); |
31 | 46 | initialize(); |
|
Collapse file
Copy file name to clipboard +30Lines changed: 30 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 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
Copy file name to clipboardExpand all lines: src/main/resources/mixins.ares.json +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
|
7 | 7 | "maxShiftBy": 5 |
8 | 8 | }, |
9 | 9 | "mixins": [ |
10 | | - "SoundMixin" |
| 10 | + "SoundMixin", |
| 11 | + "InvisiblePlayerMixin" |
11 | 12 | ], |
12 | 13 | "client": [], |
13 | 14 | "verbose": true |
|