Skip to content

Commit

Permalink
fix: fix micro's cool:tm: code
Browse files Browse the repository at this point in the history
  • Loading branch information
xtrm-en committed Jan 24, 2023
1 parent b0c1085 commit a9177e3
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 83 deletions.
9 changes: 8 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,14 @@ configurations {
}

repositories {
maven { url 'https://repo.polyfrost.cc/releases' }
maven {
url 'https://repo.polyfrost.cc/releases'
content {
// force use of snapshots
excludeModule("cc.polyfrost", "oneconfig-1.8.9-forge")
}
}
maven { url 'https://repo.polyfrost.cc/snapshots' }
}

dependencies {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
/*
* Hytils Reborn - Hypixel focused Quality of Life mod.
* Copyright (C) 2020, 2021, 2022, 2023 Polyfrost, Sk1er LLC and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package cc.woverflow.hytils.mixin;

import cc.polyfrost.oneconfig.utils.hypixel.HypixelUtils;
import cc.polyfrost.oneconfig.utils.hypixel.LocrawInfo;
import cc.polyfrost.oneconfig.utils.hypixel.LocrawUtil;
import cc.woverflow.hytils.HytilsReborn;
import cc.woverflow.hytils.config.HytilsConfig;
import net.minecraftforge.client.GuiIngameForge;
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;

import java.util.Arrays;

@Mixin(value = GuiIngameForge.class, remap = false)
public class GuiIngameForgeMixin_HideHotbar {
// currently doesn't account for admin abuse lobbies, duels lobby pvp, or housing pvp
@Inject(method = "renderHealth", at = @At("HEAD"), cancellable = true)
public void cancelHealthbar(int width, int height, CallbackInfo ci) {
LocrawInfo locraw = LocrawUtil.INSTANCE.getLocrawInfo();
if (HytilsConfig.hideHudElements && locraw != null && HypixelUtils.INSTANCE.isHypixel()) {
if (HytilsReborn.INSTANCE.getLobbyChecker().playerIsInLobby()) {
ci.cancel();
return;
}

LocrawInfo.GameType gameType = locraw.getGameType();
switch (gameType) {
case DROPPER:
case HOUSING:
case BEDWARS:
ci.cancel();
return;
}

String gameMode = locraw.getGameMode();
Arrays.asList(
"DUELS_PARKOUR",
"DUELS_BOWSPLEEF_DUEL",
"DUELS_PARKOUR",
"DUELS_BOXING_DUEL"
).forEach((mode) -> {
if (gameMode.contains(mode)) {
ci.cancel();
}
});
}
}

@Inject(method = "renderFood", at = @At("HEAD"), cancellable = true)
public void cancelFood(int width, int height, CallbackInfo ci) {
LocrawInfo locraw = LocrawUtil.INSTANCE.getLocrawInfo();
if (HytilsConfig.hideHudElements && locraw != null && HypixelUtils.INSTANCE.isHypixel()) {
if (HytilsReborn.INSTANCE.getLobbyChecker().playerIsInLobby()) {
ci.cancel();
return;
}

LocrawInfo.GameType gameType = locraw.getGameType();
switch (gameType) {
case BEDWARS:
case MURDER_MYSTERY:
case HOUSING:
case TNT_GAMES:
case CLASSIC_GAMES:
case COPS_AND_CRIMS:
case SMASH_HEROES:
case PIT:
case WARLORDS:
case DROPPER:
case DUELS:
case WOOL_GAMES:
ci.cancel();
}
}
}

@Inject(method = "renderArmor", at = @At("HEAD"), cancellable = true)
public void cancelArmor(int width, int height, CallbackInfo ci) {
LocrawInfo locraw = LocrawUtil.INSTANCE.getLocrawInfo();
if (HytilsConfig.hideHudElements && locraw != null && HypixelUtils.INSTANCE.isHypixel()) {
if (HytilsReborn.INSTANCE.getLobbyChecker().playerIsInLobby()) {
ci.cancel();
return;
}

LocrawInfo.GameType gameType = locraw.getGameType();
String gameMode = locraw.getGameMode();
switch (gameType) {
case DUELS:
// break out of the switch if it's a duels game that has armor
if (gameMode.contains("DUELS_SW_DUEL") || gameMode.contains("DUELS_UHC_MEEUP_DUEL")) {
break;
}
case DROPPER:
case TNT_GAMES:
ci.cancel();
}
}
}
}
2 changes: 1 addition & 1 deletion src/main/resources/mixins.hytils.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"GuiChatMixin_PlayAutocomplete",
"GuiIngameAccessor",
"GuiIngameForgeMixin_HideActionbar",
"GUIIngameForgeMixin_HideHotbar",
"GuiIngameForgeMixin_HideHotbar",
"GuiIngameForgeMixin_TitleEvent",
"GuiNewChatAccessor",
"GuiNewChatMixin_LocrawHider",
Expand Down

1 comment on commit a9177e3

@MicrocontrollersDev
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

Please sign in to comment.