Posted May 4, 201312 yr I have a chest whose inventory size changes depending on the variables in the TileEntity. While it runs perfectly at "open time", the container only ever gets that one chance to calculate the number of slots to draw. Trying to reload the container failed horribly (Java.lang.ArrayIndexOutOfBounds with Index = NaN) and I know of no way to "refresh" it, seeing as all calculations are called from the constructor. Is there a way to do what I want to do, without simply forcing the GUI to closeGui (which is annoying and impractical)? My Container: public ContainerScaleChest(IInventory par1IInventory, TileEntityScaleableChest par2IInventory) { lowerScaleChestInventory = par2IInventory; chest = par2IInventory; size = par2IInventory.getSizeInventory(); par2IInventory.openChest(); this.setSlots(par1IInventory, par2IInventory); } private void setSlots(IInventory par1IInventory, TileEntityScaleableChest te) { int var3 = 0; int var4 = 8; int var5 = 18; int page = chest.page; int rowsize = size; if (rowsize > chest.MAXROWS*9) rowsize = chest.MAXROWS*9; if (page == chest.getMaxPage()) { rowsize = size-(page*9*chest.MAXROWS); } int rows = (int)Math.ceil(rowsize/9D); int x = 0; int y = 0; //ReikaJavaLibrary.pConsole(size); //ReikaJavaLibrary.pConsole(rowsize); //ReikaJavaLibrary.pConsole(page); for (var3 = 0; var3 < rowsize; var3++) { y = var5+var3/9*18; x = var4+18*(var3%9); //ReikaJavaLibrary.pConsole(var3+" -> "+x+", "+y); this.addSlotToContainer(new Slot(te, var3+page*9*chest.MAXROWS, x, y)); } var5 = chest.MAXROWS*18+31;//rows*18+31; //var4 = 44+18*(rows-1); int k; for (k = 0; k < 3; ++k) { for (int m = 0; m < 9; ++m) { var3 = m+9*k; y = var5+k*18; x = var4+18*m; this.addSlotToContainer(new Slot(par1IInventory, m + k * 9 + 9, x, y)); } } var5 += 58; for (k = 0; k < 9; ++k) { y = var5; x = var4+18*k; this.addSlotToContainer(new Slot(par1IInventory, k, x, y)); } } public void reset(IInventory par1IInventory, TileEntityScaleableChest te) { //inventorySlots.clear(); //this.func_94533_d(); //this.setSlots(par1IInventory, te); } Follow my mod(s) here: http://www.minecraftforum.net/topic/1969694-
May 10, 201312 yr Author ...Nothing? Follow my mod(s) here: http://www.minecraftforum.net/topic/1969694-
May 10, 201312 yr My guess is client/server disparity. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
May 11, 201312 yr Author My guess is client/server disparity. Containers are only loaded server-side, so how I could get a disparity within itself is beyond me. Follow my mod(s) here: http://www.minecraftforum.net/topic/1969694-
May 11, 201312 yr My guess is client/server disparity. Containers are only loaded server-side, so how I could get a disparity within itself is beyond me. But the GUI is client side! (And the tile entity is on both) Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
May 11, 201312 yr Author My guess is client/server disparity. Containers are only loaded server-side, so how I could get a disparity within itself is beyond me. But the GUI is client side! (And the tile entity is on both) The GUI works fine. The item slots (that is, what index slots correlate to what index in inventory[]) are controlled by the Container alone. Follow my mod(s) here: http://www.minecraftforum.net/topic/1969694-
May 15, 201312 yr Author Um...bump? Follow my mod(s) here: http://www.minecraftforum.net/topic/1969694-
May 18, 201312 yr Author I really hate doing this, but I am desperate for a solution to this... Follow my mod(s) here: http://www.minecraftforum.net/topic/1969694-
June 8, 201312 yr Author One last bump. I would have done this earlier, but the forum page was down for two weeks... Follow my mod(s) here: http://www.minecraftforum.net/topic/1969694-
June 9, 201312 yr I doubt what you're trying to do is possible. I would recommend posing your problem to Lex (i.e. suggest a Forge hook for it), but be warned of flame. BEWARE OF GOD --- Co-author of Pentachoron Labs' SBFP Tech.
June 9, 201312 yr That thing is something what i want to know too. Is it possible to change the container with a number inside of an tile? i mean if in the tile is something like that: int containermode = -1; if(containermode == 0) { loadContainerSize1; } else if(containermode == 1) { loadContainerSize2; } else { loadContainerSize0; } is this possible?
June 9, 201312 yr That thing is something what i want to know too. Is it possible to change the container with a number inside of an tile? i mean if in the tile is something like that: int containermode = -1; if(containermode == 0) { loadContainerSize1; } else if(containermode == 1) { loadContainerSize2; } else { loadContainerSize0; } is this possible? Easily. Put a check in getClientGUIElement(TE). BEWARE OF GOD --- Co-author of Pentachoron Labs' SBFP Tech.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.