Larger guis
rubensworks opened this issue ยท 17 comments
Provide some default taller and wider gui's with more columns. (auto-scaling?)
As suggested by: https://minecraft.curseforge.com/projects/colossal-chests?comment=43
@rubensworks Here's the fixed UI texture. If you approve I'll go ahead and make the code changes to add it.
The way I'm doing it right now flat out changes the interface to this. It's not optional. Are you comfortable with that?
I should add that I undertook this because the players on my server asked if it could be done easily just for us, but since you have an issue up with this exact thing I figured I'd run the change by you in case you're interested.
@Glockshna I'd rather have it configurable actually.
To be honest, the thing I had in mind was to automatically make the gui as wide and high as possible, depending on the player's screen. This will of course require some tiling of the texture, instead of a single texture.
Alright I'll just keep it a one off for my server then. If I drink too much coffee one night and make it configurable I'll give you a shout. I'd have to take a deeper look at how you're doing your gui before I attempt that though.
Somewhat related before I let you go, I think there's a minor mistake ContainerColossalChest.java
It looks like you declared CHEST_INVENTORY_ROWS but forgot to use it later on.
I fixed it in my fork.
Glockshna@92c9fb0
That tripped me up when I was trying to expand the interface.
@Glockshna Oh, you're right. Feel free to send a PR for that single commit.
Here's my version of this change. Let me know if you change your mind on a PR for it. Glockshna@02e074e
I made the UI wider and taller, 15 columns and 9 rows but I'm having a few problems I want to solve before I go any further.
I can't get the mod to compile. It fails with this log and I can't seem to find a solution:
I'm using Eclipse and when I cloned the project it was complaining about the exact same thing gradlew is complaining about. Switching it to Java 1.8 fixed all those issues. I'm guessing I need to switch it in gradle somewhere but I'm not sure where. I don't have a lot of experience with this so it's probably something dumb I'm missing.
The second thing is the text at the top of the ui for the colossal chest. Where is that coming from? It would be nice if it could be moved, or even removed?
@Glockshna This repo uses submodules, so you'll have to execute git submodule init && git submodule update
to init those, which will resolve your issue.
Your scrollbar seems to be in a strange place, since it is used to scroll in the chest inventory, not the player inventory.
I don't intend to remove the text, you'll probably have to take that into account when you make your gui texture.
@rubensworks I had a feeling the scrollbar was going to come up, I am planning on moving it back to the chest and just getting rid of one column to accommodate it, but I wanted to get the compilation issue resolved first.
How does your GUI handle displaying slots that aren't available? The way I have this configured is each row has 12 columns. A 3x3x3 chest has 729 slots. 729 is not divisible by 12, but it is divisible by 9.
for a 3x3x3 https://github.com/CyclopsMC/ColossalChests/blob/master-1.10/src/main/java/org/cyclops/colossalchests/inventory/container/ContainerColossalChest.java#L74 is trying to create a chest with 60 rows of 12 slots which totals to 720 slots. What is happening to the missing 9 slots in this case? I think this may be related to the InvTweaks issue.
Also the Index that InvTweaks is complaining about always seems to be a few rows of capacity larger than the chest it's trying to operate on.
A 3x3x3 Chest's capacity is 729.
- When the row length is 12 the index InvTweaks complains about is 756. Exactly 3 rows in capacity to large.
- When the row length is 9 the index is 765, exactly 4 rows too large.
A 4x4x4 Chest's capacity is 1728
- When the row length is 9 the index is 1764, just as before, it's exactly 4 rows too large.
I didn't test beyond this point because I don't know enough about how your mod works behind the scenes to really find the cause of this without potentially breaking other stuff without even knowing so I'm going to leave this info here and call it good.
My changes seem to break inventory tweaks, it'll start throwing LOTS of errors and crashes the game if you middle click sort the chest. Gonna need to do a bit of investigative work. Inventory Sorter doesn't care though. It works fine.
@Glockshna You're probably going to have to update the Inventory Tweaks annotation here as well, to include the new row and column count:
@rubensworks I'll look into it. I appreciate the help.
Doesn't look like that was the issue. I went ahead and added rowSize = 12 which from what I gather it wants the number of columns. Either way it didn't work. The same issue persists. InvTweaks is complaining of
Failed to trigger shortcut: Index: 756, Size: 756
[08:51:39] [Client thread/INFO]: [invtweaks.InvTweaks:logInGameError:479]: java.lang.IndexOutOfBoundsException: Index: 756, Size: 756
any time I even so much as click with the chest open. If I sort it, CTD.
Not sure what it could be then. Perhaps having a look at the Inventory Tweaks source code could help with debugging this.
Ah yes, of course, the current codebase assumes divisibility of 9, because of inventory sizes being a multiple of 9.
For a non-multiple of 9, the last row of the chest will be a special case, and this method will have to be adapted a bit to take into account this last row.