aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorsyeyoung <cyoung06@naver.com>2021-11-28 00:01:39 +0900
committersyeyoung <cyoung06@naver.com>2021-11-28 00:01:39 +0900
commit6f2c152bf80e0033426eaf8644b43e400412ba20 (patch)
tree1ef847a3008feb1bb27f71a36c4d7def5831ad0f /src/main
parent5b2be90cd5b5b7231220d44559f1002912bb29be (diff)
downloadSkyblock-Dungeons-Guide-6f2c152bf80e0033426eaf8644b43e400412ba20.tar.gz
Skyblock-Dungeons-Guide-6f2c152bf80e0033426eaf8644b43e400412ba20.tar.bz2
Skyblock-Dungeons-Guide-6f2c152bf80e0033426eaf8644b43e400412ba20.zip
- Suggestion 255
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/FeatureCustomPartyFinder.java45
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyListElement.java18
2 files changed, 63 insertions, 0 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/FeatureCustomPartyFinder.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/FeatureCustomPartyFinder.java
index 5e14fb13..ef8dd47e 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/FeatureCustomPartyFinder.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/FeatureCustomPartyFinder.java
@@ -24,11 +24,18 @@ import kr.syeyoung.dungeonsguide.features.listener.*;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.inventory.ContainerChest;
import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.client.event.GuiOpenEvent;
+import java.util.HashSet;
+import java.util.Set;
+
public class FeatureCustomPartyFinder extends SimpleFeature implements GuiOpenListener, GuiUpdateListener {
public FeatureCustomPartyFinder() {
super("Party","Custom Party Finder","Custom Party Finder", "party.customfinder", true);
@@ -41,6 +48,9 @@ public class FeatureCustomPartyFinder extends SimpleFeature implements GuiOpenLi
@Setter
private int minimumCata;
+ @Getter @Setter
+ private String lastClass = "";
+
GuiCustomPartyFinder guiCustomPartyFinder;
@Override
public void onGuiOpen(GuiOpenEvent event) {
@@ -66,5 +76,40 @@ public class FeatureCustomPartyFinder extends SimpleFeature implements GuiOpenLi
if (guiCustomPartyFinder != null) {
guiCustomPartyFinder.onChestUpdate(windowUpdateEvent);
}
+
+ if (Minecraft.getMinecraft().currentScreen instanceof GuiChest) {
+ GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen;
+
+ if (!(chest.inventorySlots instanceof ContainerChest)) return;
+ ContainerChest containerChest = (ContainerChest) chest.inventorySlots;
+ IInventory lower = containerChest.getLowerChestInventory();
+ if (lower == null || !lower.getName().equals("Catacombs Gate")) return;
+
+ ItemStack item = null;
+ if (windowUpdateEvent.getWindowItems() != null) {
+ item = windowUpdateEvent.getWindowItems().getItemStacks()[47];
+ } else if (windowUpdateEvent.getPacketSetSlot() != null) {
+ if (windowUpdateEvent.getPacketSetSlot().func_149173_d() != 47) return;
+ item = windowUpdateEvent.getPacketSetSlot().func_149174_e();
+ }
+ if (item == null) return;
+
+ NBTTagCompound stackTagCompound = item.getTagCompound();
+ if (stackTagCompound.hasKey("display", 10)) {
+ NBTTagCompound nbttagcompound = stackTagCompound.getCompoundTag("display");
+
+ if (nbttagcompound.getTagId("Lore") == 9) {
+ NBTTagList nbttaglist1 = nbttagcompound.getTagList("Lore", 8);
+
+ for (int i = 0; i < nbttaglist1.tagCount(); i++) {
+ String str = nbttaglist1.getStringTagAt(i);
+ System.out.println(str);
+ if (str.startsWith("§aCurrently Selected")) {
+ lastClass = str.substring(24);
+ }
+ }
+ }
+ }
+ }
}
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyListElement.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyListElement.java
index 5fbfa565..b98598e4 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyListElement.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/party/customgui/PanelPartyListElement.java
@@ -18,10 +18,12 @@
package kr.syeyoung.dungeonsguide.features.impl.party.customgui;
+import kr.syeyoung.dungeonsguide.features.FeatureRegistry;
import kr.syeyoung.dungeonsguide.gui.MPanel;
import kr.syeyoung.dungeonsguide.gui.elements.MTooltip;
import kr.syeyoung.dungeonsguide.gui.elements.MTooltipText;
import kr.syeyoung.dungeonsguide.utils.RenderUtils;
+import kr.syeyoung.dungeonsguide.utils.TextUtils;
import kr.syeyoung.dungeonsguide.utils.cursor.EnumCursor;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
@@ -40,7 +42,10 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.EnumChatFormatting;
import java.awt.*;
+import java.util.HashSet;
import java.util.List;
+import java.util.Locale;
+import java.util.Set;
public class PanelPartyListElement extends MPanel {
private PanelPartyFinder panelPartyFinder;
@@ -74,6 +79,7 @@ public class PanelPartyListElement extends MPanel {
if (itemStack.getItem() == Item.getItemFromBlock(Blocks.bedrock)) cantjoin = true;
int minClass = -1, minDungeon = -1;
int pplIn = 0;
+ Set<String> dungeonClasses = new HashSet<>();
{
NBTTagCompound stackTagCompound = itemStack.getTagCompound();
if (stackTagCompound.hasKey("display", 10)) {
@@ -92,11 +98,18 @@ public class PanelPartyListElement extends MPanel {
minDungeon = Integer.parseInt(str.substring(28));
} else if (str.startsWith("§cRequires ")) cantjoin = true;
if (str.endsWith("§b)")) pplIn ++;
+
+ if (str.startsWith(" ") && str.contains(":")) {
+ String clazz = TextUtils.stripColor(str).trim().split(" ")[1];
+ dungeonClasses.add(clazz);
+ }
}
}
}
}
+ boolean nodupe = note.toLowerCase().contains("nodupe") || note.toLowerCase().contains("no dupe") || (note.toLowerCase().contains("nd") && (note.indexOf("nd") == 0 || note.charAt(note.indexOf("nd")-1) == ' '));
+
note = note.replaceAll("(?i)(S\\+)", "§6$1§r");
note = note.replaceAll("(?i)(carry)", "§4$1§r");
@@ -120,6 +133,11 @@ public class PanelPartyListElement extends MPanel {
} else if (note.contains("§6")){
color = RenderUtils.blendTwoColors(color, 0x44FFAA00);
}
+
+ if (nodupe && dungeonClasses.contains(FeatureRegistry.PARTYKICKER_CUSTOM.getLastClass())) {
+ color = RenderUtils.blendTwoColors(color, 0x44FF0000);
+ note = note.replace("nodupe", "§cnodupe§r").replace("no dupe", "§cno dupe§r").replace("nd", "§cnd§r");
+ }
Gui.drawRect(0,0,getBounds().width,getBounds().height,color);
RenderItem renderItem= Minecraft.getMinecraft().getRenderItem();