Skip to content

Commit

Permalink
1.4.0
Browse files Browse the repository at this point in the history
new: add wcore
fix: fix limbo limiter
fix: fix trim line separator
fix: make title event only activate in hypixel
  • Loading branch information
Wyvest committed Feb 10, 2022
1 parent 58ac852 commit fd2b874
Show file tree
Hide file tree
Showing 13 changed files with 135 additions and 295 deletions.
24 changes: 14 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ plugins {
id "java"
}

version = "1.4.0-alpha1"
version = "1.4.0"
group = modGroup
archivesBaseName = "Hytilities-Reborn"

Expand All @@ -39,7 +39,7 @@ minecraft {
mappings = "stable_22"
makeObfSourceJar = false

clientJvmArgs += '-Dfml.coreMods.load=net.wyvest.hytilities.forge.FMLLoadingPlugin'
clientJvmArgs += '-Dfml.coreMods.load=net.wyvest.hytilities.forge.HytilsWCoreTweaker'
clientRunArgs += "--tweakClass gg.essential.loader.stage0.EssentialSetupTweaker"
clientRunArgs += "--mixin mixins.hytilities.json"
}
Expand All @@ -52,25 +52,29 @@ configurations {

repositories {
mavenCentral()
maven { url "https://repo.sk1er.club/repository/maven-releases/" }
maven { url "https://jitpack.io/" }
maven { url "https://repo.spongepowered.org/repository/maven-public/" }
maven { url 'https://repo.woverflow.cc/' }
}

dependencies {
include("gg.essential:loader-launchwrapper:1.1.3") {
include ('gg.essential:loader-launchwrapper:1.1.3') {
transitive = false
}
compileOnly 'gg.essential:essential-1.8.9-forge:1788'
compileOnly annotationProcessor ('org.spongepowered:mixin:0.8.5-SNAPSHOT')
annotationProcessor("com.google.code.gson:gson:2.2.4")
annotationProcessor("com.google.guava:guava:21.0")
annotationProcessor("org.ow2.asm:asm-tree:6.2")
compileOnly 'cc.woverflow:w-core:1.1.3'
include ('cc.woverflow:w-core-tweaker:1.0.2') {
transitive = false
}
implementation "gg.essential:essential-1.8.9-forge:1655+release-launch"

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

jar {
manifest.attributes(
"ModSide": "CLIENT",
"FMLCorePluginContainsFMLMod": "No",
"FMLCorePlugin": "net.wyvest.hytilities.forge.FMLLoadingPlugin",
"FMLCorePlugin": "net.wyvest.hytilities.forge.HytilsWCoreTweaker",
"TweakClass": "gg.essential.loader.stage0.EssentialSetupTweaker",
"TweakOrder": "0",
"FMLAT": "hytilities_at.cfg",
Expand Down
9 changes: 3 additions & 6 deletions src/main/java/net/wyvest/hytilities/Hytilities.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package net.wyvest.hytilities;

import cc.woverflow.wcore.utils.Updater;
import gg.essential.api.EssentialAPI;
import gg.essential.universal.ChatColor;
import net.minecraft.client.Minecraft;
Expand Down Expand Up @@ -58,7 +59,6 @@
import net.wyvest.hytilities.handlers.lobby.npc.NPCHandler;
import net.wyvest.hytilities.handlers.render.ChestHighlighter;
import net.wyvest.hytilities.handlers.silent.SilentRemoval;
import net.wyvest.hytilities.updater.Updater;
import net.wyvest.hytilities.util.HypixelAPIUtils;
import net.wyvest.hytilities.util.friends.FriendCache;
import net.wyvest.hytilities.util.locraw.LocrawUtil;
Expand All @@ -77,13 +77,11 @@ public class Hytilities {

public static final String MOD_ID = "hytilities-reborn";
public static final String MOD_NAME = "Hytilities Reborn";
public static final String VERSION = "1.4.0-alpha1";
public static final String VERSION = "1.4.0";

@Mod.Instance(MOD_ID)
public static Hytilities INSTANCE;

public File jarFile;

public File modDir = new File(new File(Minecraft.getMinecraft().mcDataDir, "W-OVERFLOW"), MOD_NAME);

private HytilitiesConfig config;
Expand All @@ -107,7 +105,7 @@ public class Hytilities {
@Mod.EventHandler
public void onFMLPreInitialization(FMLPreInitializationEvent event) {
if (!modDir.exists()) modDir.mkdirs();
jarFile = event.getSourceFile();
Updater.INSTANCE.addToUpdater(event.getSourceFile(), MOD_NAME, MOD_ID, VERSION, "W-OVERFLOW/" + MOD_ID);
}

@Mod.EventHandler
Expand All @@ -125,7 +123,6 @@ public void init(FMLInitializationEvent event) {
HeightHandler.INSTANCE.initialize();

registerHandlers();
Updater.update();
}

@Mod.EventHandler
Expand Down
23 changes: 0 additions & 23 deletions src/main/java/net/wyvest/hytilities/config/HytilitiesConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
import kotlin.jvm.functions.Function0;
import net.minecraft.client.Minecraft;
import net.wyvest.hytilities.Hytilities;
import net.wyvest.hytilities.updater.DownloadGui;
import net.wyvest.hytilities.updater.Updater;
import net.wyvest.hytilities.util.ColorUtils;

import java.awt.*;
Expand Down Expand Up @@ -694,27 +692,6 @@ public static void editHeightOverlay() {
)
public static boolean mysteryBoxStar;

// Updater

@Property(
type = PropertyType.SWITCH, name = "Show Update Notification",
description = "Show a notification when you start Minecraft informing you of new updates.",
category = "Updater"
)
public static boolean showUpdate = true;

@Property(
type = PropertyType.BUTTON, name = "Update Now",
description = "Update by clicking the button.",
category = "Updater"
)
public void update() {
if (Updater.shouldUpdate) EssentialAPI.getGuiUtil()
.openScreen(new DownloadGui());
else EssentialAPI.getNotifications()
.push("Hytilities Reborn", "No update had been detected at startup, and thus the update GUI has not been shown.");
}

@Property(
type = PropertyType.NUMBER, name = "DO NOT MODIFY THIS VALUE",
description = "Config version",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
package net.wyvest.hytilities.forge;


import org.spongepowered.asm.lib.tree.ClassNode;
import org.objectweb.asm.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,35 +18,14 @@

package net.wyvest.hytilities.forge;

import cc.woverflow.wcore.tweaker.WCoreTweaker;
import net.minecraftforge.common.ForgeVersion;
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;

import java.util.Map;

@IFMLLoadingPlugin.MCVersion(ForgeVersion.mcVersion)
public class FMLLoadingPlugin implements IFMLLoadingPlugin {
public class HytilsWCoreTweaker extends WCoreTweaker {
@Override
public String[] getASMTransformerClass() {
return new String[]{ClassTransformer.class.getName()};
}

@Override
public String getModContainerClass() {
return null;
}

@Override
public String getSetupClass() {
return null;
}

@Override
public void injectData(Map<String, Object> map) {

}

@Override
public String getAccessTransformerClass() {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package net.wyvest.hytilities.handlers.lobby.limbo;

import net.minecraft.util.EnumChatFormatting;
import net.wyvest.hytilities.Hytilities;
import net.wyvest.hytilities.config.HytilitiesConfig;
import net.wyvest.hytilities.handlers.chat.modules.modifiers.DefaultChatRestyler;
Expand All @@ -36,7 +37,7 @@ public class LimboLimiter {

@SubscribeEvent
public void onChat(ClientChatReceivedEvent event) {
final String message = event.message.getUnformattedText();
final String message = EnumChatFormatting.getTextWithoutFormattingCodes(event.message.getUnformattedText());
final LanguageData language = Hytilities.INSTANCE.getLanguageHandler().getCurrent();

if (message.equals(language.limboLimiterSpawned) || message.equals(language.limboLimiterAfk)) {
Expand Down
55 changes: 55 additions & 0 deletions src/main/java/net/wyvest/hytilities/hooks/TrimLineSeparator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Hytilities Reborn - Hypixel focused Quality of Life mod.
* Copyright (C) 2022 W-OVERFLOW
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package net.wyvest.hytilities.hooks;

import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IChatComponent;
import net.wyvest.hytilities.config.HytilitiesConfig;

import java.util.List;
import java.util.ListIterator;

public final class TrimLineSeparator {
public static boolean isSeparatingChat = false;

public static void trimLineSeparator(List<IChatComponent> list) {
if (HytilitiesConfig.lineBreakerTrim) {
ListIterator<IChatComponent> iterator = list.listIterator();
while (iterator.hasNext()) {
IChatComponent next = iterator.next();
if (iterator.hasNext()) {
if (isSeparator(EnumChatFormatting.getTextWithoutFormattingCodes(next.getUnformattedText()))) {
while (iterator.hasNext()) {
IChatComponent nextNext = iterator.next();
if (isSeparator(EnumChatFormatting.getTextWithoutFormattingCodes(nextNext.getUnformattedText()))) {
iterator.remove();
} else {
break;
}
}
}
}
}
}
}

public static boolean isSeparator(String s) {
return (s.startsWith("-") && s.endsWith("-")) || (s.startsWith("▬") && s.endsWith("▬")) || (s.startsWith("≡") && s.endsWith("≡"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package net.wyvest.hytilities.mixin;

import gg.essential.api.EssentialAPI;
import net.wyvest.hytilities.Hytilities;
import net.wyvest.hytilities.events.TitleEvent;
import net.minecraft.client.Minecraft;
Expand All @@ -44,13 +45,15 @@ private boolean isHardcore(WorldInfo instance) {

@Inject(method = "renderTitle", at = @At("HEAD"), cancellable = true)
private void postTitleEvent(int l, int age, float opacity, CallbackInfo ci) {
TitleEvent event = new TitleEvent(displayedTitle, displayedSubTitle);
MinecraftForge.EVENT_BUS.post(event);
if (EssentialAPI.getMinecraftUtil().isHypixel()) {
TitleEvent event = new TitleEvent(displayedTitle, displayedSubTitle);
MinecraftForge.EVENT_BUS.post(event);

// Set the title and subtitle to empty strings.
if (event.isCanceled()) {
displayTitle(null, null, -1, -1, -1);
ci.cancel();
// Set the title and subtitle to empty strings.
if (event.isCanceled()) {
displayTitle(null, null, -1, -1, -1);
ci.cancel();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Hytilities Reborn - Hypixel focused Quality of Life mod.
* Copyright (C) 2022 W-OVERFLOW
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package net.wyvest.hytilities.mixin.lineseparator;

import net.minecraft.client.gui.GuiNewChat;
import net.minecraft.util.IChatComponent;
import net.wyvest.hytilities.hooks.TrimLineSeparator;
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;

@Mixin(GuiNewChat.class)
public class GuiNewChatMixin {
@Inject(method = "setChatLine", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiUtilRenderComponents;splitText(Lnet/minecraft/util/IChatComponent;ILnet/minecraft/client/gui/FontRenderer;ZZ)Ljava/util/List;"))
private void beforeSplitText(IChatComponent chatComponent, int chatLineId, int updateCounter, boolean displayOnly, CallbackInfo ci) {
TrimLineSeparator.isSeparatingChat = true;
}

@Inject(method = "setChatLine", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiUtilRenderComponents;splitText(Lnet/minecraft/util/IChatComponent;ILnet/minecraft/client/gui/FontRenderer;ZZ)Ljava/util/List;", shift = At.Shift.AFTER))
private void afterSplitText(IChatComponent chatComponent, int chatLineId, int updateCounter, boolean displayOnly, CallbackInfo ci) {
TrimLineSeparator.isSeparatingChat = false;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Hytilities Reborn - Hypixel focused Quality of Life mod.
* Copyright (C) 2021 W-OVERFLOW
* Copyright (C) 2022 W-OVERFLOW
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
Expand All @@ -16,52 +16,31 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package net.wyvest.hytilities.mixin;
package net.wyvest.hytilities.mixin.lineseparator;

import net.minecraft.client.gui.GuiUtilRenderComponents;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IChatComponent;
import net.wyvest.hytilities.config.HytilitiesConfig;
import net.wyvest.hytilities.hooks.TrimLineSeparator;
import org.spongepowered.asm.mixin.Dynamic;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

import java.util.ArrayList;
import java.util.List;

@Mixin(GuiUtilRenderComponents.class)
public class GuiUtilRenderComponentsMixin_TrimLineBreaker {
public class GuiUtilRenderComponentsMixin {

@Dynamic
@Redirect(method = "splitText", at = @At(value = "INVOKE", target = "Ljava/util/List;add(Ljava/lang/Object;)Z", ordinal = 1))
private static boolean trimLineSeparator(List<IChatComponent> list, Object obj) {
boolean value = false;
if (obj instanceof IChatComponent) {
value = list.add((IChatComponent) obj);
if (HytilitiesConfig.lineBreakerTrim) {
boolean seperatorFound = false;
int i = -1;
List<Integer> remove = new ArrayList<>();
for (IChatComponent component : list) {
i++;
String s = EnumChatFormatting.getTextWithoutFormattingCodes(component.getUnformattedText());

if ((s.startsWith("---") && s.endsWith("---")) || (s.startsWith("▬▬▬") && s.endsWith("▬▬▬")) || (s.startsWith("≡≡≡") && s.endsWith("≡≡≡"))) {
if (seperatorFound) {
remove.add(i);
} else {
seperatorFound = true;
}
} else if (seperatorFound) {
seperatorFound = false;
}
}
for (Integer removed : remove) {
list.remove((int) removed);
}
}
}
TrimLineSeparator.trimLineSeparator(list);
return value;
}


}

0 comments on commit fd2b874

Please sign in to comment.