Sponge
Sponge copied to clipboard
InventoryMenu#registerChange does not appear to be called
Affected Product(s)
SpongeVanilla
Version
1.16.5-8.1.0-RC1235
Operating System
Windows
Java Version
17.0.2/64-bit (Eclipse Adoptium)
Plugins/Mods
None (other than my own)
Describe the bug
InventoryMenu's register change listener appears to never run, no matter what I do (left click, shift click into, swap manually, swap with key).
How I created my inventory:
public ViewableInventory guiTools() {
var emptyFill = ItemStack.builder().itemType(ItemTypes.GRAY_STAINED_GLASS_PANE)
.add(org.spongepowered.api.data.Keys.DISPLAY_NAME, Component.empty()).build().createSnapshot();
var base = Inventory.builder().slots(16).completeStructure().plugin(container).build();
var inventory = ViewableInventory.builder().type(ContainerTypes.GENERIC_9X4)
.slotsAtIndizes(base.slots(), List.of(2, 11, 20, 29, 10, 12, 5, 6, 14, 15, 16, 23, 24, 25, 32, 33))
.fillDummy().item(emptyFill).completeStructure().plugin(container).build();
inventory.set(2, emptyFill);
return inventory;
}
I have the following code in a InteractEntityEvent listener, but it probably can go anywhere:
public void modifyEntity(InteractEntityEvent.Secondary event) {
var inv = guiTools(stand);
var menu = inv.asMenu();
menu.setReadOnly(false);
menu.registerChange((a, b, c, d, e , f) -> {
System.out.println("FF");
return true;
});
menu.registerSlotClick((a, b, c, d, e) -> {
System.out.println("GG");
return true;
});
menu.open(p);
}
I have verified that the inventory menu works by seeing the GG in the output logs, but I do not see any FF.
Link to logs
No response