aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java35
1 files changed, 23 insertions, 12 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java
index 66fede9c..53607fae 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java
@@ -6,6 +6,7 @@ import io.github.moulberry.notenoughupdates.miscgui.StorageOverlay;
import io.github.moulberry.notenoughupdates.util.SBInfo;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.client.Minecraft;
+import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.ContainerChest;
@@ -147,6 +148,7 @@ public class StorageManager {
public static class StoragePage {
public ItemStack[] items = new ItemStack[45];
public ItemStack backpackDisplayStack;
+ public String customTitle;
public int rows = -1;
public transient boolean matchesSearch;
@@ -314,7 +316,9 @@ public class StorageManager {
System.currentTimeMillis() - storageOpenSwitchMillis < 1000) return;
if(getCurrentPageId() == page) return;
- if(getCurrentWindowId() != -1 && onStorageMenu) {
+ if(page == 0) {
+ NotEnoughUpdates.INSTANCE.sendChatMessage("/enderchest");
+ } else if(getCurrentWindowId() != -1 && onStorageMenu) {
if(page < 9) {
sendMouseClick(getCurrentWindowId(), 9+page);
} else {
@@ -324,13 +328,15 @@ public class StorageManager {
storageOpenSwitchMillis = System.currentTimeMillis();
desiredStoragePage = page;
- NotEnoughUpdates.INSTANCE.sendChatMessage("/storage");
+ NotEnoughUpdates.INSTANCE.sendChatMessage("/storage " + (desiredStoragePage-8));
}
}
private void sendMouseClick(int windowId, int slotIndex) {
- Minecraft.getMinecraft().playerController.windowClick(windowId, slotIndex, 0, 0,
- Minecraft.getMinecraft().thePlayer);
+ EntityPlayerSP playerIn = Minecraft.getMinecraft().thePlayer;
+ short short1 = playerIn.openContainer.getNextTransactionID(playerIn.inventory);
+ ItemStack itemstack = playerIn.openContainer.getSlot(slotIndex).getStack();
+ Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C0EPacketClickWindow(windowId, slotIndex, 0, 0, itemstack, short1));
}
public int getDisplayIdForStorageId(int storageId) {
@@ -343,6 +349,19 @@ public class StorageManager {
return -1;
}
+ public boolean onAnyClick() {
+ if(onStorageMenu && desiredStoragePage >= 0) {
+ if(desiredStoragePage < 9) {
+ sendMouseClick(getCurrentWindowId(), 9+desiredStoragePage);
+ } else {
+ sendMouseClick(getCurrentWindowId(), 27+desiredStoragePage-MAX_ENDER_CHEST_PAGES);
+ }
+ desiredStoragePage = -1;
+ return true;
+ }
+ return false;
+ }
+
public void openWindowPacket(S2DPacketOpenWindow packet) {
shouldRenderStorageOverlayCached = false;
if(!NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) return;
@@ -357,14 +376,6 @@ public class StorageManager {
if(windowTitle.trim().equals("Storage")) {
onStorageMenu = true;
-
- if(desiredStoragePage >= 0 && System.currentTimeMillis() - storageOpenSwitchMillis < 1000) {
- if(desiredStoragePage < 9) {
- sendMouseClick(getCurrentWindowId(), 9+desiredStoragePage);
- } else {
- sendMouseClick(getCurrentWindowId(), 27+desiredStoragePage-MAX_ENDER_CHEST_PAGES);
- }
- }
} else if(matcher.matches()) {
int page = Integer.parseInt(matcher.group(1));