aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kr/syeyoung
diff options
context:
space:
mode:
authorsyeyoung <cyong06@naver.com>2021-01-04 15:02:32 +0900
committersyeyoung <cyong06@naver.com>2021-01-04 15:02:32 +0900
commitece0af65a8bba6c722ac6f0853c570d2e8cad784 (patch)
treeb4c37277b5f99df700115d40c09e21a0bfc4af40 /src/main/java/kr/syeyoung
parentc9f71d77a5912a70546d6a0950d7f8c2bb4c89db (diff)
downloadSkyblock-Dungeons-Guide-ece0af65a8bba6c722ac6f0853c570d2e8cad784.tar.gz
Skyblock-Dungeons-Guide-ece0af65a8bba6c722ac6f0853c570d2e8cad784.tar.bz2
Skyblock-Dungeons-Guide-ece0af65a8bba6c722ac6f0853c570d2e8cad784.zip
many things
Diffstat (limited to 'src/main/java/kr/syeyoung')
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java52
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java1
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureChestPrice.java101
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureCooldownCounter.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureInstaCloseChest.java13
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureTooltipDungeonStat.java2
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureTooltipPrice.java12
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiBackgroundRenderListener.java7
-rw-r--r--src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiPreRenderListener.java7
9 files changed, 185 insertions, 12 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java
index ea84dfc3..2e8e8adc 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/eventlistener/FeatureListener.java
@@ -5,10 +5,7 @@ import kr.syeyoung.dungeonsguide.e;
import kr.syeyoung.dungeonsguide.features.*;
import kr.syeyoung.dungeonsguide.features.AbstractFeature;
import kr.syeyoung.dungeonsguide.features.listener.*;
-import net.minecraftforge.client.event.ClientChatReceivedEvent;
-import net.minecraftforge.client.event.GuiOpenEvent;
-import net.minecraftforge.client.event.RenderGameOverlayEvent;
-import net.minecraftforge.client.event.RenderWorldLastEvent;
+import net.minecraftforge.client.event.*;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
@@ -99,7 +96,7 @@ public class FeatureListener {
}
}
@SubscribeEvent
- public void onTick(GuiOpenEvent tick) {
+ public void onGuiOpen(GuiOpenEvent tick) {
try {
SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus();
if (!skyblockStatus.isOnSkyblock()) return;
@@ -113,4 +110,49 @@ public class FeatureListener {
t.printStackTrace();
}
}
+ @SubscribeEvent
+ public void onGuiRender(GuiScreenEvent.DrawScreenEvent.Post render) {
+ try {
+ SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus();
+ if (!skyblockStatus.isOnSkyblock()) return;
+
+ for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) {
+ if (abstractFeature instanceof GuiPostRenderListener) {
+ ((GuiPostRenderListener) abstractFeature).onGuiPostRender(render);
+ }
+ }
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+ @SubscribeEvent
+ public void onGuiRender(GuiScreenEvent.DrawScreenEvent.Pre render) {
+ try {
+ SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus();
+ if (!skyblockStatus.isOnSkyblock()) return;
+
+ for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) {
+ if (abstractFeature instanceof GuiPreRenderListener) {
+ ((GuiPreRenderListener) abstractFeature).onGuiPreRender(render);
+ }
+ }
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+ @SubscribeEvent
+ public void onGuiRender(GuiScreenEvent.BackgroundDrawnEvent render) {
+ try {
+ SkyblockStatus skyblockStatus = e.getDungeonsGuide().getSkyblockStatus();
+ if (!skyblockStatus.isOnSkyblock()) return;
+
+ for (AbstractFeature abstractFeature : FeatureRegistry.getFeatureList()) {
+ if (abstractFeature instanceof GuiBackgroundRenderListener) {
+ ((GuiBackgroundRenderListener) abstractFeature).onGuiBGRender(render);
+ }
+ }
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java
index c5b9daa1..6a66a13f 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java
@@ -54,4 +54,5 @@ public class FeatureRegistry {
public static final FeatureInstaCloseChest DUNGEON_INSTACLOSE = register(new FeatureInstaCloseChest());
public static final FeatureBoxSkelemaster DUNGEON_BOXSKELEMASTER = register(new FeatureBoxSkelemaster());
public static final SimpleFeature FIX_SPIRIT_BOOTS = register(new SimpleFeature("fixes", "Spirit Boots Fixer", "Fix Spirit boots messing up with inventory", "fixes.spirit", true));
+ public static final SimpleFeature BOSSFIGHT_CHESTPRICE = register(new FeatureChestPrice());
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureChestPrice.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureChestPrice.java
new file mode 100644
index 00000000..432f3169
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureChestPrice.java
@@ -0,0 +1,101 @@
+package kr.syeyoung.dungeonsguide.features.impl;
+
+import kr.syeyoung.dungeonsguide.e;
+import kr.syeyoung.dungeonsguide.features.SimpleFeature;
+import kr.syeyoung.dungeonsguide.features.listener.GuiBackgroundRenderListener;
+import kr.syeyoung.dungeonsguide.features.listener.GuiPostRenderListener;
+import kr.syeyoung.dungeonsguide.features.listener.GuiPreRenderListener;
+import kr.syeyoung.dungeonsguide.utils.TextUtils;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraft.client.gui.inventory.GuiChest;
+import net.minecraft.client.renderer.GlStateManager;
+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.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.StatCollector;
+import net.minecraftforge.client.event.GuiScreenEvent;
+import org.lwjgl.opengl.GL11;
+
+import java.util.HashMap;
+import java.util.TreeMap;
+
+public class FeatureChestPrice extends SimpleFeature implements GuiBackgroundRenderListener {
+ public FeatureChestPrice() {
+ super("Bossfight", "Show Profit of Dungeon Chests","Show Profit of Dungeon Chests", "bossfight.profitchest", true);
+ }
+
+ @Override
+ public void onGuiBGRender(GuiScreenEvent.BackgroundDrawnEvent rendered) {
+ if (!isEnabled()) return;
+ if (!(rendered.gui instanceof GuiChest)) return;
+ if (!e.getDungeonsGuide().getSkyblockStatus().isOnDungeon()) return;
+
+ GL11.glColor4f(1,1,1,1);
+ GlStateManager.disableLighting();
+
+ ContainerChest chest = (ContainerChest) ((GuiChest) rendered.gui).inventorySlots;
+ IInventory actualChest = chest.getLowerChestInventory();
+
+ int chestPrice = 0;
+ int itemPrice = 0;
+ for (int i = 0; i <actualChest.getSizeInventory(); i++) {
+ ItemStack item = actualChest.getStackInSlot(i);
+ if (item != null) {
+ if (item.getDisplayName() != null && item.getDisplayName().contains("Reward")) {
+ NBTTagCompound tagCompound = item.serializeNBT().getCompoundTag("tag");
+ if (tagCompound.hasKey("display", 10)) {
+ NBTTagCompound nbttagcompound = tagCompound.getCompoundTag("display");
+
+ if (nbttagcompound.getTagId("Lore") == 9) {
+ NBTTagList nbttaglist1 = nbttagcompound.getTagList("Lore", 8);
+
+ if (nbttaglist1.tagCount() > 0) {
+ for (int j1 = 0; j1 < nbttaglist1.tagCount(); ++j1) {
+ String str = nbttaglist1.getStringTagAt(j1);
+ if (str.endsWith("Coins")) {
+ String coins = TextUtils.stripColor(str).replace(" Coins", "").replace(",","");
+ try {
+ chestPrice = Integer.parseInt(coins);
+ } catch (Exception e) {
+
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ itemPrice += FeatureInstaCloseChest.getPrice(item) * item.stackSize;
+ }
+ }
+
+ int i = 222;
+ int j = i - 108;
+ int ySize = j + (actualChest.getSizeInventory() / 9) * 18;
+ int left = (rendered.gui.width + 176) / 2;
+ int top = (rendered.gui.height - ySize ) / 2;
+
+ int width = 120;
+
+ GL11.glPushMatrix();
+ GL11.glTranslated(left, top, 0);
+ Gui.drawRect( 0,0,width, 30, 0xFFDDDDDD);
+
+ FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
+ fr.drawString("BIN/AH Price: ", 5,5, 0xFF000000);
+ String str = TextUtils.format(itemPrice);
+ fr.drawString(str, width - fr.getStringWidth(str) - 5, 5, 0xFF000000);
+
+ fr.drawString("Profit: ", 5,15, 0xFF000000);
+ str = (itemPrice > chestPrice ? "+" : "") +TextUtils.format(itemPrice - chestPrice);
+ fr.drawString(str, width - fr.getStringWidth(str) - 5, 15, itemPrice > chestPrice ? 0xFF00CC00 : 0xFFCC0000);
+
+ GL11.glPopMatrix();
+ }
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureCooldownCounter.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureCooldownCounter.java
index 276dfe3f..17efd2e8 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureCooldownCounter.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureCooldownCounter.java
@@ -13,7 +13,7 @@ import java.awt.*;
public class FeatureCooldownCounter extends GuiFeature implements TickListener {
public FeatureCooldownCounter() {
- super("HUD", "Dungeon Cooldown Counter", "Counts 10 seconds after leaving dungeon", "qol.cooldown", true, getFontRenderer().getStringWidth("Cooldown: 10s "), getFontRenderer().FONT_HEIGHT);
+ super("ETC", "Dungeon Cooldown Counter", "Counts 10 seconds after leaving dungeon", "qol.cooldown", true, getFontRenderer().getStringWidth("Cooldown: 10s "), getFontRenderer().FONT_HEIGHT);
parameters.put("color", new FeatureParameter<Color>("color", "Color", "Color of text", Color.white, "color"));
}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureInstaCloseChest.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureInstaCloseChest.java
index f8069d73..74c0cec3 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureInstaCloseChest.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureInstaCloseChest.java
@@ -14,6 +14,7 @@ import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiScreen;
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.minecraftforge.client.event.GuiOpenEvent;
@@ -21,6 +22,7 @@ import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.util.Comparator;
+import java.util.HashMap;
import java.util.Set;
import java.util.TreeSet;
@@ -35,7 +37,6 @@ public class FeatureInstaCloseChest extends SimpleFeature implements GuiOpenList
@Override
public void onGuiOpen(GuiOpenEvent event) {
if (!this.isEnabled()) return;
-
if (!skyblockStatus.isOnDungeon()) return;
if (!(event.gui instanceof GuiChest)) return;
@@ -46,7 +47,7 @@ public class FeatureInstaCloseChest extends SimpleFeature implements GuiOpenList
check = true;
}
- public int getPrice(ItemStack itemStack) {
+ public static int getPrice(ItemStack itemStack) {
if (itemStack == null) return 0;
NBTTagCompound compound = itemStack.getTagCompound();
if (compound == null)
@@ -104,9 +105,13 @@ public class FeatureInstaCloseChest extends SimpleFeature implements GuiOpenList
GuiScreen screen = Minecraft.getMinecraft().currentScreen;
if (screen instanceof GuiChest){
+
+ ContainerChest chest = (ContainerChest) ((GuiChest) screen).inventorySlots;
+ IInventory actualChest = chest.getLowerChestInventory();
+
int priceSum = 0;
- for (ItemStack inventoryItemStack : ((GuiChest) screen).inventorySlots.inventoryItemStacks) {
- priceSum += getPrice(inventoryItemStack);
+ for (int i = 0; i < actualChest.getSizeInventory(); i++) {
+ priceSum += getPrice(actualChest.getStackInSlot(i));
}
int threshold = this.<Integer>getParameter("threshold").getValue();
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureTooltipDungeonStat.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureTooltipDungeonStat.java
index 250d230d..a3f10c30 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureTooltipDungeonStat.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureTooltipDungeonStat.java
@@ -9,7 +9,7 @@ import net.minecraftforge.event.entity.player.ItemTooltipEvent;
public class FeatureTooltipDungeonStat extends SimpleFeature implements TooltipListener {
public FeatureTooltipDungeonStat() {
- super("tooltip", "Dungeon Item Stats", "Shows quality of dungeon items (floor, percentage)", "tooltip.dungeonitem");
+ super("ETC", "Dungeon Item Stats", "Shows quality of dungeon items (floor, percentage)", "tooltip.dungeonitem");
}
@Override
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureTooltipPrice.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureTooltipPrice.java
index b9059427..68393ca2 100644
--- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureTooltipPrice.java
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureTooltipPrice.java
@@ -1,5 +1,6 @@
package kr.syeyoung.dungeonsguide.features.impl;
+import kr.syeyoung.dungeonsguide.features.FeatureParameter;
import kr.syeyoung.dungeonsguide.features.FeatureRegistry;
import kr.syeyoung.dungeonsguide.features.SimpleFeature;
import kr.syeyoung.dungeonsguide.features.listener.TooltipListener;
@@ -8,6 +9,7 @@ import kr.syeyoung.dungeonsguide.utils.TextUtils;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
+import org.lwjgl.input.Keyboard;
import java.util.Comparator;
import java.util.Set;
@@ -15,19 +17,27 @@ import java.util.TreeSet;
public class FeatureTooltipPrice extends SimpleFeature implements TooltipListener {
public FeatureTooltipPrice() {
- super("tooltip", "Item Price", "Shows price of items", "tooltip.price");
+ super("ETC", "Item Price", "Shows price of items", "tooltip.price");
+ parameters.put("reqShift", new FeatureParameter<Boolean>("reqShift", "Require Shift", "If shift needs to be pressed in order for this feature to be activated", false, "boolean"));
}
@Override
public void onTooltip(ItemTooltipEvent event) {
if (!isEnabled()) return;
+ boolean activated = !this.<Boolean>getParameter("reqShift").getValue() || Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
+
ItemStack hoveredItem = event.itemStack;
NBTTagCompound compound = hoveredItem.getTagCompound();
if (compound == null)
return;
if (!compound.hasKey("ExtraAttributes"))
return;
+ if (!activated) {
+ event.toolTip.add("ยง7Shift to view price");
+ return;
+ }
+
final String id = compound.getCompoundTag("ExtraAttributes").getString("id");
if (id.equals("ENCHANTED_BOOK")) {
final NBTTagCompound enchants = compound.getCompoundTag("ExtraAttributes").getCompoundTag("enchantments");
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiBackgroundRenderListener.java b/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiBackgroundRenderListener.java
new file mode 100644
index 00000000..df1bbecf
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiBackgroundRenderListener.java
@@ -0,0 +1,7 @@
+package kr.syeyoung.dungeonsguide.features.listener;
+
+import net.minecraftforge.client.event.GuiScreenEvent;
+
+public interface GuiBackgroundRenderListener {
+ void onGuiBGRender(GuiScreenEvent.BackgroundDrawnEvent rendered);
+}
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiPreRenderListener.java b/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiPreRenderListener.java
new file mode 100644
index 00000000..6183b9f5
--- /dev/null
+++ b/src/main/java/kr/syeyoung/dungeonsguide/features/listener/GuiPreRenderListener.java
@@ -0,0 +1,7 @@
+package kr.syeyoung.dungeonsguide.features.listener;
+
+import net.minecraftforge.client.event.GuiScreenEvent;
+
+public interface GuiPreRenderListener {
+ void onGuiPreRender(GuiScreenEvent.DrawScreenEvent.Pre rendered);
+}