[SPIGOT-4718] Can not create Inventory with an custom size Created: 23/Apr/19 Updated: 28/Jun/19 Resolved: 24/Apr/19 |
|
Status: | Resolved |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | Minor |
Reporter: | derNiklaas | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 3 |
Labels: | 1.14 | ||
Environment: |
OS: Linux, openjdk version "1.8.0_191" |
Attachments: |
![]() |
||||||||||||
Issue Links: |
|
||||||||||||
Version: | git-Spigot-6dbf995-0ec9b61 | ||||||||||||
Guidelines Read: | Yes |
Description |
You can not create an Inventory with an custom size. Source Code: https://hastebin.com/tiqoqazuxa.java The JavaDocs mentions that you can use multiples of nine: https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Bukkit.html#createInventory-org.bukkit.inventory.InventoryHolder-int-java.lang.String- but only 27 and 54 works Error: |
Comments |
Comment by detig_iii [ 28/Jun/19 ] |
@md_5 Could you maybe state how we're going to handle custom inventories in the future? As of now it is impossible to create anything outside of the 9x3 size ( |
Comment by detig_iii [ 15/Jun/19 ] |
So does this mean we can no longer create inventories with sizes other than 27 or 54?
|
Comment by derNiklaas [ 23/Apr/19 ] |
Oh, I am just dumb. Sorry xD |
Comment by Nassim [ 23/Apr/19 ] |
Didn't think I had to specifically mention it, but take a look 2 lines above the one I sent, then you'll find the problem, too 👀 |
Comment by derNiklaas [ 23/Apr/19 ] |
@Nassim: The default type of an Inventory created by Bukkit#createInventory(InventoryHolder,int,String) is a chest, not a barrel. It should trigger https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java#225 because no delegate should be defined. |
Comment by Nassim [ 23/Apr/19 ] |
Found the problem, https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java#171 is always setting 3 rows for any type of chests, resulting in the error. |
Comment by Jocke155 [ 23/Apr/19 ] |
I can confirm that also size 0 no longer works. In 1.13.2 having an inventory with size 0 resulted in no slots in the top inventory, but still possible to to access the InventoryHolder and Title, this was very useful for selecting items in the players inventory etc. |