Skip to content

Commit

Permalink
v0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
RedthMC committed Oct 30, 2022
1 parent 3bfbc43 commit d2bc93c
Show file tree
Hide file tree
Showing 11 changed files with 123 additions and 107 deletions.
18 changes: 6 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,29 +1,23 @@
# Eclipse
eclipse
# eclipse
bin
*.launch
.settings
.metadata
.classpath
.project

# Idea
# idea
out
classes
*.ipr
*.iws
*.iml
.idea

# Gradle
# gradle
build
.gradle

# Netbeans
.nb-gradle
.nb-gradle-properties

# Other
# other
eclipse
run
.DS_Store
Thumbs.db
.hprof
45 changes: 11 additions & 34 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
/*
* Hypixel Addons - A customizable quality of life mod for Hypixel
* Copyright (c) 2021 kr45732
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

buildscript {
repositories {
maven { url 'https://jitpack.io' }
Expand All @@ -35,7 +17,7 @@ apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'org.spongepowered.mixin'
apply plugin: 'com.github.johnrengelman.shadow'

version = "0.0.1"
version = "0.1"
group = "me.redth"
archivesBaseName = "MMCUtils"
String modid = "mmcutils"
Expand All @@ -58,23 +40,19 @@ configurations {
repositories {
maven { url 'https://jitpack.io' }
maven { url 'https://repo.spongepowered.org/repository/maven-public/' }
maven { url 'https://maven.minecraftforge.net/' }
flatDir {
dirs 'libs'
}
maven { url 'https://repo.essential.gg/repository/maven-public'}
// maven { url 'https://maven.minecraftforge.net/' }
}

dependencies {
include("org.spongepowered:mixin:0.7.11-SNAPSHOT") {
exclude module: "guava"
exclude module: "commons-io"
exclude module: "gson"
exclude module: "launchwrapper"
include('gg.essential:loader-launchwrapper:1.1.3') {
transitive = false
}

implementation name: 'optifine-1.8.9'
implementation 'gg.essential:essential-1.8.9-forge:3760'
implementation 'org.spongepowered:mixin:0.7.11-SNAPSHOT'

annotationProcessor "org.spongepowered:mixin:0.7.11-SNAPSHOT"
annotationProcessor 'org.spongepowered:mixin:0.7.11-SNAPSHOT'
}

reobf {
Expand All @@ -96,10 +74,9 @@ shadowJar {

jar {
manifest.attributes(
"TweakClass": "org.spongepowered.asm.launch.MixinTweaker",
"MixinConfigs": "mixins.${modid}.json",
"FMLCorePluginContainsFMLMod": true,
"ForceLoadAsMod": true
'ModSide': 'CLIENT',
'ForceLoadAsMod': true,
'TweakClass': 'gg.essential.loader.stage0.EssentialSetupTweaker',
)

enabled = false
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
21 changes: 2 additions & 19 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
#
# Hypixel Addons - A customizable quality of life mod for Hypixel
# Copyright (c) 2021 kr45732
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#

#Mon Sep 14 12:28:28 PDT 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip
20 changes: 1 addition & 19 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
#!/usr/bin/env sh

#
# Hypixel Addons - A customizable quality of life mod for Hypixel
# Copyright (c) 2021 kr45732
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#

#
# Copyright 2015 the original author or authors.
#
Expand Down Expand Up @@ -200,4 +182,4 @@ APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

exec "$JAVACMD" "$@"
exec "$JAVACMD" "$@"
2 changes: 1 addition & 1 deletion gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,4 @@ exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
:omega
Binary file removed libs/optifine-1.8.9.jar
Binary file not shown.
65 changes: 65 additions & 0 deletions src/main/java/me/redth/mmcutils/Config.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package me.redth.mmcutils;

import gg.essential.vigilance.Vigilant;
import gg.essential.vigilance.data.Property;
import gg.essential.vigilance.data.PropertyType;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.BlockPos;

import java.io.File;
import java.util.Collections;
import java.util.List;

public class Config extends Vigilant {

@Property(type = PropertyType.SWITCH, name = "Auto Queue", category = "General", description = "Automatically queues your current proxy's practice server when connected.")
public static boolean autoQueue = true;

@Property(type = PropertyType.SWITCH, name = "Auto Party Chat", category = "General", description = "Automatically enters party chat when connected.")
public static boolean autoPartyChat = true;

@Property(type = PropertyType.SWITCH, name = "Height Limit Overlay", category = "General", description = "Darkens wools and terracottas at height limit.")
public static boolean heightLimitOverlay = true;

@Property(type = PropertyType.PERCENT_SLIDER, name = "Height Limit Brightness", category = "General", description = "How bright the blocks will be.")
public static float heightLimitBrightness = 0.5F;

public Config() {
super(new File("./config/mmcutils.toml"));
initialize();
}

public static class Command extends CommandBase {

@Override
public String getCommandName() {
return "mmcutils";
}

@Override
public String getCommandUsage(ICommandSender sender) {
return "/mmcutils";
}

@Override
public void processCommand(ICommandSender sender, String[] args) {
MMCUtils.showConfig = true;
}

@Override
public List<String> getCommandAliases() {
return Collections.emptyList();
}

@Override
public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
return Collections.emptyList();
}

@Override
public boolean canCommandSenderUseCommand(ICommandSender sender) {
return true;
}
}
}
47 changes: 29 additions & 18 deletions src/main/java/me/redth/mmcutils/MMCUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,63 @@

import com.google.common.collect.ImmutableList;
import net.minecraft.client.Minecraft;
import net.minecraftforge.client.ClientCommandHandler;
import net.minecraftforge.client.event.ClientChatReceivedEvent;
import net.minecraftforge.client.event.RenderWorldEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import net.minecraftforge.fml.common.network.FMLNetworkEvent;

@Mod(modid = "mmcutils", name = "MMCUtils", version = "1.0", clientSideOnly = true, acceptedMinecraftVersions = "1.8.9")
@Mod(modid = "mmcutils", name = "MMCUtils", version = "0.1", clientSideOnly = true, acceptedMinecraftVersions = "1.8.9")
public class MMCUtils {
private static final Minecraft mc = Minecraft.getMinecraft();
public static final ImmutableList<String> ALL_PROXY = ImmutableList.of("AS Practice", "EU Practice", "NA Practice", "SA Practice");
public static final Minecraft MC = Minecraft.getMinecraft();
public static boolean onMMC;
public static boolean inPartyChat = false;
public static Config config;
public static boolean inMMC, inPractice, inPartyChat, showConfig;

@Mod.EventHandler
public void init(FMLInitializationEvent e) {
MinecraftForge.EVENT_BUS.register(this);
ClientCommandHandler.instance.registerCommand(new Config.Command());
config = new Config();
}

@SubscribeEvent
public void onTick(TickEvent.ClientTickEvent e) {
if (e.phase == TickEvent.Phase.START) return;

if (showConfig) {
mc.displayGuiScreen(config.gui());
showConfig = false;
}
}

@SubscribeEvent
public void onJoin(FMLNetworkEvent.ClientConnectedToServerEvent e) {
if (!e.isLocal && MC.getCurrentServerData().serverIP.contains("minemen.club")) onMMC = true;
if (!e.isLocal && mc.getCurrentServerData().serverIP.contains("minemen.club")) inMMC = true;
}

@SubscribeEvent
public void onQuit(FMLNetworkEvent.ClientDisconnectionFromServerEvent e) {
onMMC = false;
inPartyChat = false;
inMMC = inPractice = inPartyChat = false;
}

@SubscribeEvent
public void onChat(ClientChatReceivedEvent e) {
if (!onMMC || inPartyChat) return;
if (!inMMC) return;

String s = e.message.getUnformattedText();

if (ALL_PROXY.contains(s)) {
MC.thePlayer.sendChatMessage("/p chat");
inPartyChat = true;
} else if ("Minemen Club".equals(s)) {
String[] split = MC.getCurrentServerData().serverIP.split(".minemen.club");
if (!inPractice && "Minemen Club".equals(e.message.getUnformattedText()) && Config.autoQueue) {
String[] split = mc.getCurrentServerData().serverIP.split(".minemen.club");
String mmcProxy = split[0].length() == 2 ? split[0] : "na";
MC.thePlayer.sendChatMessage("/joinqueue " + mmcProxy + "-practice");
mc.thePlayer.sendChatMessage("/joinqueue " + mmcProxy + "-practice");
inPractice = true;
}

if (!inPartyChat && ALL_PROXY.contains(e.message.getUnformattedText()) && Config.autoPartyChat) {
mc.thePlayer.sendChatMessage("/p chat");
inPartyChat = true;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.redth.mmcutils.mixin;

import me.redth.mmcutils.Config;
import me.redth.mmcutils.MMCUtils;
import net.minecraft.block.BlockColored;
import net.minecraft.block.state.IBlockState;
Expand All @@ -15,12 +16,12 @@
public class BlockModelRendererMixin {
@Redirect(method = "renderQuadsSmooth", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/WorldRenderer;putColorMultiplier(FFFI)V"))
public void modifyArgs(WorldRenderer instance, float l, float i1, float j1, int k1, IBlockAccess worldIn, IBlockState stateIn, BlockPos blockPosIn) {
if (MMCUtils.onMMC && blockPosIn.getY() == 99 && stateIn.getBlock() instanceof BlockColored) {
if (MMCUtils.inMMC && Config.heightLimitOverlay && blockPosIn.getY() == 99 && stateIn.getBlock() instanceof BlockColored) {
int meta = stateIn.getValue(BlockColored.COLOR).getMetadata();
if (meta == 14 || meta == 11) {
l *= 0.5F;
i1 *= 0.5F;
j1 *= 0.5F;
l *= Config.heightLimitBrightness;
i1 *= Config.heightLimitBrightness;
j1 *= Config.heightLimitBrightness;
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/mcmod.info
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
"mcversion": "${mcversion}",
"authorList": [
"Redth"
],
"dependencies": [
"essential"
]
}
]

0 comments on commit d2bc93c

Please sign in to comment.