Skip to content

Commit 1186c89

Browse files
committed
v0.1.5
1 parent f0adea7 commit 1186c89

File tree

10 files changed

+62
-24
lines changed

10 files changed

+62
-24
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ Utilities for Minemen Club
66
- **Auto Party Chat** - Enter party chat once joined practice.
77
- **Height Overlay** - Make wools and terracottas darker at height limit.
88
- **Height Overlay Darkness** - Adjust the darkness of height limit overlay.
9+
- **Height Overlay Distance HUD** - Shows how many blocks you are away from height limit.
910

10-
Configurable in OneConfig menu
11+
Configurable in `OneConfig` menu
1112

1213
# Requirements
1314
- OptiFine Smooth Lighting: On

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ repositories {
9595
dependencies {
9696
// Adds the OneConfig library, so we can develop with it.
9797
modCompileOnly("cc.polyfrost:oneconfig-$platform:0.2.0-alpha+")
98-
98+
implementation(files("libs/optifine-1.8.9.jar"))
9999
// If we are building for legacy forge, includes the launch wrapper with `shade` as we configured earlier.
100100
if (platform.isLegacyForge) {
101101
compileOnly("org.spongepowered:mixin:0.7.11-SNAPSHOT")

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ mod_name=MMCUtils
55
# Sets the id of your mod that mod loaders use to recognize it.
66
mod_id=mmcutils
77
# Sets the version of your mod. Make sure to update this when you make changes according to semver.
8-
mod_version=1.0.4
8+
mod_version=1.0.5
99
# Sets the name of the jar file that you put in your 'mods' folder.
1010
mod_archives_name=MMCUtils
1111

root.gradle.kts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,5 @@ plugins {
55
}
66

77
preprocess {
8-
"1.12.2-forge"(11202, "srg") {
9-
"1.8.9-forge"(10809, "srg")
10-
}
8+
"1.8.9-forge"(10809, "srg")
119
}

settings.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ rootProject.buildFileName = "root.gradle.kts"
2121
// Adds all of our build target versions to the classpath if we need to add version-specific code.
2222
listOf(
2323
"1.8.9-forge", // Update this if you want to remove/add a version, along with `build.gradle.kts` and `root.gradle.kts`.
24-
"1.12.2-forge"
2524
).forEach { version ->
2625
include(":$version")
2726
project(":$version").apply {

src/main/java/me/redth/mmcutils/Configuration.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,28 @@
22

33

44
import cc.polyfrost.oneconfig.config.Config;
5+
import cc.polyfrost.oneconfig.config.annotations.HUD;
56
import cc.polyfrost.oneconfig.config.annotations.Slider;
67
import cc.polyfrost.oneconfig.config.annotations.Switch;
78
import cc.polyfrost.oneconfig.config.data.Mod;
89
import cc.polyfrost.oneconfig.config.data.ModType;
910

1011
public class Configuration extends Config {
1112

12-
@Switch(name = "Auto Practice", description = "Go straight into practice once joined.")
13+
@Switch(name = "Auto Practice", subcategory = "Joining", description = "Go straight into practice once joined.")
1314
public static boolean autoQueue = true;
1415

15-
@Switch(name = "Auto Party Chat", description = "Enter party chat once joined practice.")
16+
@Switch(name = "Auto Party Chat", subcategory = "Joining", description = "Enter party chat once joined practice.")
1617
public static boolean autoPartyChat = true;
1718

18-
@Switch(name = "Height Overlay", description = "Make wools and terracottas darker at height limit.")
19+
@Switch(name = "Height Overlay", subcategory = "Height Overlay", description = "Make wools and terracottas darker at height limit.")
1920
public static boolean heightLimitOverlay = true;
2021

21-
@Slider(name = "Height Overlay Darkness", min = 0, max = 1000, step = 100, description = "Adjust the darkness of height limit overlay.")
22-
public static int heightLimitDarkness = 300;
22+
@Slider(name = "Height Overlay Darkness", subcategory = "Height Overlay", min = 0, max = 10, step = 1, description = "Adjust the darkness of height limit overlay.")
23+
public static int heightLimitDarkness = 3;
24+
25+
@HUD(name = "Height Limit Distance HUD", subcategory = "Shows how many blocks you are away from height limit.")
26+
public static HeightLimitHud hud = new HeightLimitHud();
2327

2428
public Configuration() {
2529
super(new Mod("MMCUtils", ModType.UTIL_QOL), "mmcutils.json");
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package me.redth.mmcutils;
2+
3+
import cc.polyfrost.oneconfig.config.annotations.Text;
4+
import cc.polyfrost.oneconfig.hud.TextHud;
5+
import net.minecraft.client.Minecraft;
6+
7+
import java.util.List;
8+
9+
public class HeightLimitHud extends TextHud {
10+
@Text(name = "Format", description = "How the text should be displayed.")
11+
public String format = "Height Limit Distance: %s";
12+
13+
public HeightLimitHud() {
14+
super(false);
15+
}
16+
17+
@Override
18+
protected void getLines(List<String> lines, boolean example) {
19+
if (MMCUtils.inBridgingGame) {
20+
int dist = 100 - (int) Minecraft.getMinecraft().thePlayer.posY;
21+
lines.add(format.replace("%s", String.valueOf(dist)));
22+
} else {
23+
lines.add(format.replace("%s", "3"));
24+
}
25+
}
26+
27+
@Override
28+
protected boolean shouldShow() {
29+
return super.shouldShow() && MMCUtils.inBridgingGame;
30+
}
31+
}

src/main/java/me/redth/mmcutils/MMCUtils.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
1010
import net.minecraftforge.fml.common.network.FMLNetworkEvent;
1111

12-
@Mod(modid = "mmcutils", name = "MMCUtils", version = "0.1.4", clientSideOnly = true, acceptedMinecraftVersions = "1.8.9")
12+
@Mod(modid = "@ID@", name = "@NAME@", version = "@VER@")
1313
public class MMCUtils {
1414
private static final Minecraft mc = Minecraft.getMinecraft();
1515
public static final ImmutableList<String> ALL_PROXY = ImmutableList.of("AS Practice", "EU Practice", "NA Practice", "SA Practice");
16-
public static boolean inMMC, inPractice, inPartyChat;
16+
public static final ImmutableList<String> BRIDGING_GAMES = ImmutableList.of("Bed Fight", "Fireball Fight", "Bridges", "Battle Rush");
17+
public static boolean inMMC, inPractice, inPartyChat, inBridgingGame;
1718

1819
@Mod.EventHandler
1920
public void init(FMLInitializationEvent e) {
@@ -28,24 +29,32 @@ public void onJoin(FMLNetworkEvent.ClientConnectedToServerEvent e) {
2829

2930
@SubscribeEvent
3031
public void onQuit(FMLNetworkEvent.ClientDisconnectionFromServerEvent e) {
31-
inMMC = inPractice = inPartyChat = false;
32+
inMMC = inPractice = inPartyChat = inBridgingGame = false;
3233
}
3334

3435
@SubscribeEvent
3536
public void onChat(ClientChatReceivedEvent e) {
3637
if (!inMMC) return;
3738

38-
if (!inPractice && "Minemen Club".equals(e.message.getUnformattedText()) && Configuration.autoQueue) {
39+
String clean = e.message.getUnformattedText();
40+
if (!inPractice && "Minemen Club".equals(clean) && Configuration.autoQueue) {
3941
String[] split = mc.getCurrentServerData().serverIP.split(".minemen.club");
4042
String mmcProxy = split[0].length() == 2 ? split[0] : "na";
4143
mc.thePlayer.sendChatMessage("/joinqueue " + mmcProxy + "-practice");
4244
inPractice = true;
4345
}
4446

45-
if (!inPartyChat && ALL_PROXY.contains(e.message.getUnformattedText()) && Configuration.autoPartyChat) {
47+
if (!inPartyChat && ALL_PROXY.contains(clean) && Configuration.autoPartyChat) {
4648
mc.thePlayer.sendChatMessage("/p chat");
4749
inPartyChat = true;
4850
}
51+
52+
if (!inBridgingGame) {
53+
if (BRIDGING_GAMES.contains(clean))
54+
inBridgingGame = true;
55+
} else if (clean.startsWith("Match Results")) {
56+
inBridgingGame = false;
57+
}
4958
}
5059

5160
}

src/main/java/me/redth/mmcutils/mixin/BlockModelRendererMixin.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121
public class BlockModelRendererMixin {
2222
@ModifyArgs(method = "renderQuadsSmooth", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/WorldRenderer;putColorMultiplier(FFFI)V"))
2323
public void modifyArgs(Args args, IBlockAccess worldIn, IBlockState stateIn, BlockPos blockPosIn, WorldRenderer instance, List<BakedQuad> list, RenderEnv env) {
24-
if (MMCUtils.inMMC && Configuration.heightLimitOverlay && blockPosIn.getY() == 99 && stateIn.getBlock() instanceof BlockColored) {
24+
if (MMCUtils.inBridgingGame && Configuration.heightLimitOverlay && blockPosIn.getY() == 99 && stateIn.getBlock() instanceof BlockColored) {
2525
int meta = stateIn.getValue(BlockColored.COLOR).getMetadata();
2626
if (meta == 14 || meta == 11) {
27-
float f = 1F - Configuration.heightLimitDarkness / 1000F;
27+
float brightness = 1F - Configuration.heightLimitDarkness / 10F;
2828
for (int i = 0; i < 3; i++) {
29-
args.set(i, (float) args.get(i) * f);
29+
args.set(i, (float) args.get(i) * brightness);
3030
}
3131
}
3232
}

src/main/java/net/optifine/render/RenderEnv.java

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)