-
Notifications
You must be signed in to change notification settings - Fork 98
Updating from previous versions
Languages: Dutch (Nederlands)
Here's a list of API breaking changes which have been introduced which requires changing when updating to a newer version. Do note that if you update from multiple versions ago, you'll need to follow all steps for every update in between as well (e.g. when updating from 0.1.0 to 0.3.0 you'd need to follow both the steps in 0.2.0 and 0.3.0).
Every XML attribute previously called onClick now needs to be called onLocalClick. Also all method calls previously named setOnClick have been renamed to setOnLocalClick.
GuiLocation is completely removed. All instances where this class was used are now replaced by constructors which take in two integers, instead of one GuiLocation. Pane has been moved from pane.util to pane. x and y for panes are no longer mandatory; while currently existing code continues to work, you might want to change your custom panes to accept this behavior as well. Custom panes that are flippable, orientable or rotatable can now use the provided interfaces for this.
Every pane now needs a clear method. This method should clear any panes/items added to the pane. If your pane doesn't have items/panes, you can simply keep this method empty.
The display and click methods have been updated with the display method having an additional Gui and PlayerInventory parameter and the click method having an additional Gui parameter. Inside Gui, onLocalClick was renamed to onTopClick with the same holding true for XML. Inside the panes onLocalClick was changed to onClick, same for XML.
In Pane setOnLocalClick has been changed to setOnClick. When adding a custom property, registerProperty should be used instead of adding to getPropertyMappings. The methods to retrieve a callback (getOnClose, getAction, getOnTopClick, etc.) have been replaced with a method that directly calls the callback with error handling functionality.
In GuiItem the copy method now also copies the internal UUID.
References to Gui should be replaced with ChestGui. Custom panes should update their display and click method to have the following signatures: void display(InventoryComponent inventoryComponent, int paneOffsetX, int paneOffsetY, int maxLength, int maxHeight) and boolean click(Gui gui, InventoryClickEvent event, int slot, int paneOffsetX, int paneOffsetY, int maxLength, int maxHeight) respectively. Custom panes should display their items in the provided InventoryComponent instead of directly in the inventory. Any code related to deciding whether to place items in the inventory or player inventory should be removed: inventory components treat both as one and player inventory rows are appended to the normal inventory in inventory components. Code that sets the state of the gui should also be removed: this has now been deprecated. Click handlers should be able to work relatively similar as in the past, but should not rely on the slot from the InventoryClickEvent, but the provided slot as this one represents the slot relative to your inventory part. This slot is also set correctly with regards to the player inventory; player inventories are considered directly below the normal inventory.
The constructor for guis can no longer be called with a Plugin: remove this parameter.
Code related to setting the state of a gui should be removed; the framework now handles this itself and doesn't require additional code to decide the state for it. The click method in panes now take in the upper InventoryComponent in which the pane resides. Please add this parameter to your method signature for custom panes.
Gui#setTitle and ChestGui#setRows no longer auto-update the gui and need to be updated manually after setting them. Gui#getInventory and Gui#createInventory have been moved to InventoryBased. NamedGui#createInventory(String) no longer exists.
Minecraft version 1.14 and 1.15 are no longer supported.
Minecraft versions 1.16.1-1.16.4, 1.17.0, 1.18.0-1.18.1, and 1.19.0-1.19.3 are no longer supported.
The pages in a paginated pane now need to be continuous, so page 0, 1, 2, etc.
InventoryComponent has been renamed to GuiComponent. You can rename all old references to the new name to fix this.
Deprecated methods have been removed, such as Pane#getX, Pane#getY, Pane#setX, and Pane#setY. Panes no longer store slots themselves, but only their parent containers. Refer to the parent container if you want to get the slots that are assigned to a pane.
The Plugin parameter on load methods on panes is now mandatory. By adding a reference to your plugin as an additional argument to make use of the other load method.
Pane#loadItem is moved to GuiItem.
Label now extends Pane instead of OutlinePane.
Several utility methods in StaticPane now work across all slot types, instead of only the slot type specified. While mixing different types of slots is not recommended to begin with, if you only want the methods to work with one specific type of slot, you can filter these manually.
When an item is dropped or a gui is closed, remaining items with internal identifiers will have these stripped.
Altered signature of Pane#draw and Pane#click. Please refer to the wiki page on creating custom panes for updated documentation.
Slots are no longer specified on panes, but rather their parent container. You can remove the slot specified in the constructor and instead supply it when adding the pane to the parent container