aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/io')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java7
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java10
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java15
3 files changed, 16 insertions, 16 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
index 212bb8a4..2727c2fb 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
@@ -27,12 +27,9 @@ import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.event.ClickEvent;
-import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.inventory.ContainerChest;
import net.minecraft.inventory.IInventory;
-import net.minecraft.inventory.Slot;
-import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
@@ -1428,8 +1425,8 @@ public class NEUEventListener {
GuiChest eventGui = (GuiChest) guiScreen;
ContainerChest cc = (ContainerChest) eventGui.inventorySlots;
containerName = cc.getLowerChestInventory().getDisplayName().getUnformattedText();
- if(containerName.contains(" Profile") && eventGui.isMouseOverSlot(cc.inventorySlots.get(42), mouseX, mouseY)
- && Mouse.getEventButton() >= 0) {
+ if(containerName.contains(" Profile") && BetterContainers.profileViewerStackIndex != -1 &&
+ eventGui.isMouseOverSlot(cc.inventorySlots.get(BetterContainers.profileViewerStackIndex), mouseX, mouseY) && Mouse.getEventButton() >= 0) {
event.setCanceled(true);
if(Mouse.getEventButtonState() && eventGui.inventorySlots.inventorySlots.get(22).getStack() != null &&
eventGui.inventorySlots.inventorySlots.get(22).getStack().getTagCompound() != null){
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java
index 65ccd73f..bc92df0e 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/BetterContainers.java
@@ -57,6 +57,8 @@ public class BetterContainers {
public static HashMap<Integer, ItemStack> itemCache = new HashMap<>();
+ public static int profileViewerStackIndex = -1;
+
public static void clickSlot(int slot) {
clickedSlotMillis = System.currentTimeMillis();
clickedSlot = slot;
@@ -121,9 +123,7 @@ public class BetterContainers {
}
public static boolean isBlankStack(int index, ItemStack stack) {
- if(index == 42 && NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() &&
- (SBInfo.getInstance().lastOpenContainerName.contains("'s Profile") ||
- SBInfo.getInstance().lastOpenContainerName.contains("s' Profile"))) {
+ if(index != -1 && index == profileViewerStackIndex) {
return false;
}
@@ -137,9 +137,7 @@ public class BetterContainers {
}
public static boolean isButtonStack(int index, ItemStack stack) {
- if(index == 42 && NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() &&
- (SBInfo.getInstance().lastOpenContainerName.contains("'s Profile") ||
- SBInfo.getInstance().lastOpenContainerName.contains("s' Profile"))) {
+ if(index == profileViewerStackIndex) {
return true;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java
index 89d97dfa..db72f903 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java
@@ -54,8 +54,10 @@ public abstract class MixinGuiContainer extends GuiScreen {
GuiContainer $this = (GuiContainer)(Object)this;
- if(slot.slotNumber == 42 && $this instanceof GuiChest) {
- hasProfileViewerStack = false;
+ if(!hasProfileViewerStack && $this instanceof GuiChest && slot.getSlotIndex() > 9 && (slot.getSlotIndex() % 9 == 6 || slot.getSlotIndex() % 9 == 7) &&
+ BetterContainers.isBlankStack(-1, slot.getStack())) {
+ BetterContainers.profileViewerStackIndex = -1;
+ hasProfileViewerStack = true;
GuiChest eventGui = (GuiChest) $this;
ContainerChest cc = (ContainerChest) eventGui.inventorySlots;
@@ -80,12 +82,15 @@ public abstract class MixinGuiContainer extends GuiScreen {
this.itemRender.zLevel = 0.0F;
this.zLevel = 0.0F;
- hasProfileViewerStack = true;
+ BetterContainers.profileViewerStackIndex = slot.getSlotIndex();
}
}
}
}
- }
+ } else if (slot.getSlotIndex() == 0)
+ hasProfileViewerStack = false;
+ else if(!($this instanceof GuiChest))
+ BetterContainers.profileViewerStackIndex = -1;
if(slot.getStack() == null && NotEnoughUpdates.INSTANCE.overlay.searchMode && NEUEventListener.drawingGuiScreen) {
GlStateManager.pushMatrix();
@@ -117,7 +122,7 @@ public abstract class MixinGuiContainer extends GuiScreen {
value = "INVOKE",
target = "Lnet/minecraft/client/gui/inventory/GuiContainer;renderToolTip(Lnet/minecraft/item/ItemStack;II)V"))
public void drawScreen_renderTooltip(GuiContainer guiContainer, ItemStack stack, int x, int y) {
- if(hasProfileViewerStack && theSlot.slotNumber == 42) {
+ if(theSlot.slotNumber == BetterContainers.profileViewerStackIndex) {
this.renderToolTip(profileViewerStack, x, y);
} else {
this.renderToolTip(stack, x, y);