Skip to content

Commit 9aa01fd

Browse files
committed
Good day of progress (Bug fixes, Epic raname stuff, Housing name on tab, Inventory Viewer, Discord RPC and Action Text + more)
1 parent a610654 commit 9aa01fd

27 files changed

+1407
-34
lines changed

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ dependencies {
7070
include ('org.slick2d:slick2d-core:1.0.2') {
7171
exclude module: 'lwjgl'
7272
}
73+
include('com.github.JnCrMx:discord-game-sdk4j:v0.5.5')
7374

7475
compileOnly('org.spongepowered:mixin:0.7.11-SNAPSHOT')
7576

src/main/java/cc/woverflow/hysentials/Hysentials.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
import cc.woverflow.hysentials.guis.actionLibrary.ActionLibrary;
3030
import cc.woverflow.hysentials.guis.club.ClubDashboard;
3131
import cc.woverflow.hysentials.guis.gameMenu.RevampedGameMenu;
32+
import cc.woverflow.hysentials.guis.misc.PlayerInvHandler;
33+
import cc.woverflow.hysentials.guis.misc.PlayerInventory;
3234
import cc.woverflow.hysentials.guis.sbBoxes.SBBoxesEditor;
3335
import cc.woverflow.hysentials.handlers.cache.HeightHandler;
3436
import cc.woverflow.hysentials.handlers.chat.ChatHandler;
@@ -108,6 +110,8 @@ public class Hysentials {
108110
public boolean isChatting;
109111
private boolean loadedCall;
110112

113+
public DiscordRPC discordRPC;
114+
111115
public String rank;
112116

113117
public HamsterCompanion hamsterCompanion;
@@ -142,10 +146,25 @@ public void init(FMLInitializationEvent event) {
142146
ClientCommandHandler.instance.registerCommand(new GlobalChatCommand());
143147
ClientCommandHandler.instance.registerCommand(new HypixelChatCommand());
144148
ClientCommandHandler.instance.registerCommand(new VisitCommand());
149+
ClientCommandHandler.instance.registerCommand(new RemoveGlowCommand());
150+
ClientCommandHandler.instance.registerCommand(new GlowCommand());
151+
ClientCommandHandler.instance.registerCommand(new SetLoreLineCommand());
152+
ClientCommandHandler.instance.registerCommand(new RenameCommand());
153+
ClientCommandHandler.instance.registerCommand(new RemoveNameCommand());
154+
ClientCommandHandler.instance.registerCommand(new InsertLoreLineCommand());
155+
ClientCommandHandler.instance.registerCommand(new RemoveLoreLineCommand());
156+
ClientCommandHandler.instance.registerCommand(new OpenInvCommand());
145157
CommandManager.INSTANCE.registerCommand(new SBBoxesCommand());
146158
CommandManager.INSTANCE.registerCommand(new ActionLibraryCommand());
147159
CommandManager.INSTANCE.registerCommand(new ClubCommand());
148160

161+
try {
162+
DiscordCore.init();
163+
discordRPC = new DiscordRPC();
164+
} catch (IOException e) {
165+
throw new RuntimeException(e);
166+
}
167+
149168
HeightHandler.INSTANCE.initialize();
150169

151170
registerHandlers();
@@ -181,6 +200,8 @@ private void registerImages() {
181200
new ImageIcon("creator", new ResourceLocation("textures/icons/creator.png"));
182201
new ImageIcon("guild", new ResourceLocation("textures/icons/guild.png"));
183202
new ImageIcon("party", new ResourceLocation("textures/icons/party.png"));
203+
new ImageIcon("to", new ResourceLocation("textures/icons/to.png"));
204+
new ImageIcon("from", new ResourceLocation("textures/icons/from.png"));
184205

185206
for (HypixelRanks rank : HypixelRanks.values()) {
186207
try {
@@ -226,6 +247,7 @@ private void registerHandlers() {
226247
eventBus.register(new Exporter());
227248
eventBus.register(new HousingMenuHandler());
228249
eventBus.register(new ClubDashboard());
250+
eventBus.register(new PlayerInvHandler());
229251

230252
// height overlay
231253
EventManager.INSTANCE.register(HeightHandler.INSTANCE);
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package cc.woverflow.hysentials.command;
2+
3+
import cc.polyfrost.oneconfig.libs.universal.UChat;
4+
import cc.woverflow.hysentials.guis.container.GuiItem;
5+
import cc.woverflow.hysentials.util.Material;
6+
import net.minecraft.client.Minecraft;
7+
import net.minecraft.command.CommandBase;
8+
import net.minecraft.command.ICommandSender;
9+
import net.minecraft.enchantment.Enchantment;
10+
import net.minecraft.item.Item;
11+
import net.minecraft.item.ItemStack;
12+
13+
public class GlowCommand extends CommandBase {
14+
@Override
15+
public int getRequiredPermissionLevel() {
16+
return 0;
17+
}
18+
19+
@Override
20+
public String getCommandName() {
21+
return "glow";
22+
}
23+
24+
@Override
25+
public String getCommandUsage(ICommandSender sender) {
26+
return "/glow";
27+
}
28+
29+
@Override
30+
public void processCommand(ICommandSender sender, String[] args) {
31+
ItemStack item = Minecraft.getMinecraft().thePlayer.getHeldItem();
32+
if (item == null || item.getItem() == null) {
33+
UChat.chat("§cYou must be holding an item!");
34+
return;
35+
}
36+
if (Material.FISHING_ROD.getId() == Item.getIdFromItem(item.getItem())) {
37+
item.addEnchantment(Enchantment.infinity, 10);
38+
GuiItem.hideFlag(item, 1);
39+
RenameCommand.setCreativeAction(item, Minecraft.getMinecraft().thePlayer.inventory.currentItem);
40+
} else {
41+
item.addEnchantment(Enchantment.lure, 10);
42+
GuiItem.hideFlag(item, 1);
43+
RenameCommand.setCreativeAction(item, Minecraft.getMinecraft().thePlayer.inventory.currentItem);
44+
}
45+
UChat.chat("§aAdded glow to the item successfully!");
46+
}
47+
}

src/main/java/cc/woverflow/hysentials/command/HysentialsCommand.java

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import cc.woverflow.hysentials.htsl.compiler.Compiler;
3232
import cc.woverflow.hysentials.util.HypixelAPIUtils;
3333
import cc.woverflow.hysentials.util.JsonData;
34+
import cc.woverflow.hysentials.util.ScoreboardWrapper;
3435
import cc.woverflow.hysentials.websocket.Socket;
3536
import cc.woverflow.hytils.HytilsReborn;
3637
import cc.woverflow.hytils.config.HytilsConfig;
@@ -111,20 +112,6 @@ private static void test(String command, @Greedy String args) {
111112
break;
112113
}
113114

114-
case "htsl": {
115-
File file = new File("./config/hysentials/htsl/testing.htsl");
116-
try {
117-
new Compiler(FileUtils.readFileToString(file));
118-
} catch (IOException e) {
119-
throw new RuntimeException(e);
120-
}
121-
break;
122-
}
123-
124-
case "editor": {
125-
new CodeEditor().openGui("testing");
126-
}
127-
128115
case "averagefps": {
129116
Hysentials.INSTANCE.sendMessage("&aGetting average FPS...");
130117
Multithreading.runAsync(() -> {
@@ -143,6 +130,12 @@ private static void test(String command, @Greedy String args) {
143130
}
144131

145132
case "locraw": {
133+
System.out.println(ScoreboardWrapper.getLines(true).get(1));
134+
System.out.println(ScoreboardWrapper.getLines(true).get(2));
135+
136+
System.out.println(ScoreboardWrapper.getLines(false).get(2));
137+
System.out.println(ScoreboardWrapper.getLines(false).get(3));
138+
146139
Hysentials.INSTANCE.sendMessage("&a" + LocrawUtil.INSTANCE.getLocrawInfo().toString());
147140
break;
148141
}
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
package cc.woverflow.hysentials.command;
2+
3+
import cc.polyfrost.oneconfig.libs.universal.UChat;
4+
import cc.woverflow.hysentials.guis.container.GuiItem;
5+
import cc.woverflow.hysentials.util.C;
6+
import net.minecraft.client.Minecraft;
7+
import net.minecraft.command.CommandBase;
8+
import net.minecraft.command.ICommandSender;
9+
import net.minecraft.item.ItemStack;
10+
11+
import java.util.ArrayList;
12+
import java.util.Arrays;
13+
import java.util.List;
14+
15+
public class InsertLoreLineCommand extends CommandBase {
16+
@Override
17+
public int getRequiredPermissionLevel() {
18+
return 0;
19+
}
20+
21+
@Override
22+
public String getCommandName() {
23+
return "insertloreline";
24+
}
25+
26+
@Override
27+
public String getCommandUsage(ICommandSender sender) {
28+
return "/insertloreline <line> <value>";
29+
}
30+
31+
@Override
32+
public List<String> getCommandAliases() {
33+
return Arrays.asList("insertll", "ill");
34+
}
35+
36+
@Override
37+
public void processCommand(ICommandSender sender, String[] args) {
38+
if (args.length < 2) {
39+
UChat.chat("§cUsage: /insertloreline <line> <value>");
40+
return;
41+
}
42+
int line;
43+
try {
44+
line = Integer.parseInt(args[0]);
45+
} catch (NumberFormatException e) {
46+
UChat.chat("§cInvalid line number!");
47+
return;
48+
}
49+
if (line < 1) {
50+
UChat.chat("§cInvalid line number!");
51+
return;
52+
}
53+
54+
ItemStack item = Minecraft.getMinecraft().thePlayer.getHeldItem();
55+
if (item == null || item.getItem() == null) {
56+
UChat.chat("§cYou must be holding an item!");
57+
return;
58+
}
59+
60+
StringBuilder textArguments = new StringBuilder("");
61+
62+
for (int i = 1; i < args.length; i++) {
63+
textArguments.append(args[i] + " ");
64+
}
65+
66+
String lineToInsert = textArguments.toString().trim();
67+
68+
List<String> newLore = new ArrayList<String>();
69+
70+
lineToInsert = C.translate(lineToInsert);
71+
72+
if (GuiItem.getLore(item).size() != 0) {
73+
List<String> oldLore = GuiItem.getLore(item);
74+
75+
if (oldLore.size() < line) {
76+
UChat.chat("§cLine number is too high!");
77+
return;
78+
}
79+
80+
line = line - 1;
81+
82+
for (int i = 0; i < oldLore.size(); i++) {
83+
if (i == line) {
84+
newLore.add(lineToInsert);
85+
newLore.add(oldLore.get(i));
86+
} else {
87+
newLore.add(oldLore.get(i));
88+
}
89+
}
90+
91+
GuiItem.setLore(item, newLore);
92+
RenameCommand.setCreativeAction(item, Minecraft.getMinecraft().thePlayer.inventory.currentItem);
93+
UChat.chat("§aSuccessfully inserted line §e" + (line + 1) + "§a!");
94+
} else {
95+
UChat.chat("§cItem must have lore!");
96+
}
97+
}
98+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
package cc.woverflow.hysentials.command;
2+
3+
import cc.polyfrost.oneconfig.libs.universal.UChat;
4+
import cc.polyfrost.oneconfig.utils.commands.annotations.Command;
5+
import cc.polyfrost.oneconfig.utils.commands.annotations.SubCommand;
6+
import cc.woverflow.hysentials.guis.misc.PlayerInventory;
7+
import cc.woverflow.hysentials.handlers.redworks.HousingScoreboard;
8+
import cc.woverflow.hysentials.handlers.sbb.SbbRenderer;
9+
import net.minecraft.client.Minecraft;
10+
import net.minecraft.command.CommandBase;
11+
import net.minecraft.command.CommandException;
12+
import net.minecraft.command.ICommandSender;
13+
import net.minecraft.entity.player.EntityPlayer;
14+
15+
import java.util.Arrays;
16+
import java.util.Collections;
17+
import java.util.List;
18+
19+
public class OpenInvCommand extends CommandBase {
20+
@Override
21+
public int getRequiredPermissionLevel() {
22+
return 0;
23+
}
24+
25+
@Override
26+
public String getCommandName() {
27+
return "openinv";
28+
}
29+
30+
@Override
31+
public String getCommandUsage(ICommandSender sender) {
32+
return "/openinv <player>";
33+
}
34+
35+
@Override
36+
public List<String> getCommandAliases() {
37+
return Collections.singletonList("inv");
38+
}
39+
40+
@Override
41+
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
42+
if (SbbRenderer.housingScoreboard.getHousingName() == null) {
43+
UChat.chat("&cYou must be in a housing to use this command!");
44+
return;
45+
}
46+
if (args.length == 0) {
47+
UChat.chat("&cUsage: /openinv <player>");
48+
return;
49+
}
50+
for (EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) {
51+
if (player.getName().equals(args[0])) {
52+
new PlayerInventory(player).open();
53+
return;
54+
}
55+
}
56+
UChat.chat("&cCouldn't find a player by " + args[0] + ", make sure they are within your render distance to view their inventory!");
57+
}
58+
}

0 commit comments

Comments
 (0)