interfaces
interfaces copied to clipboard
Can modify chest interfaces
I'm using interfaces to give a shop preview, but using shift-click on items in the player inventory results in the items getting placed in the chest interface.
ChestInterface.Builder builder = ChestInterface.builder()
.rows(6)
.clickHandler(ClickHandler.cancel())
.addTransform(PaperTransform.chestFill(
ItemStackElement.of(new ItemStack(Material.BLACK_STAINED_GLASS_PANE))))
.title(Component.text("Shop preview"))
.addTransform((pane, view) ->
pane.element(ItemStackElement.of(new ItemStack(Material.STONE)), 0,0));
builder.build().open(PlayerViewer.of(player));
Attempting to merge the stacks with spam clicking also works sometimes.
The listener is registered:
getServer().getPluginManager().registerEvents(new PaperInterfaceListeners(this), this);