Open InseiderHD opened 3 years ago
I'm almost positive this is fixed, and if it isn't it will be fixed by https://github.com/PaperMC/Paper/pull/7265
Testing this there definitely seems to be weird behavior still, even tho it no longer kicks the player.
Can probably reproduce this with all container that has specific methods like player.openAnvil/Workbench... The brewing stand, furnace, blast furnace, smoker menu are also broken and has no specific method to fix that The beacon menu has its translation button broken and is broken (no specific method) The enderchest menu doesn't save items (no specific method) And in the bukkit javadoc of Bukkit#createInventory it say that workbench and enchanting table are broken
Also note that you can duplicate item in this bugged inventory
I think all of those things are fixed, or will be fixed when I continue to work on the linked PR (https://github.com/PaperMC/Paper/pull/7265)
I think all of those things are fixed, or will be fixed when I continue to work on the linked PR (#7265)
Hello, for some reasons, i still get weird behavior by creating a custom anvil inventory. First of all, as you can see in the video below, the result item doesn't appear, or appear for a very quick time. But only when i try to rename the item, it appear normally.
Also, when opening a custom anvil, the inventory cannot be cast as an AnvilInventory, so it don't trigger PrepareAnvilEvent.
Test code i used for my tests, using latest stable Paper 1.20.4 build 496:
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if(sender instanceof Player p){
Inventory inv = Bukkit.createInventory(p, InventoryType.ANVIL, Component.text("Test Custom Anvil"));
p.openInventory(inv);
}
return true;
}
@EventHandler
public void onInventoryClick(InventoryClickEvent e){
Player p = (Player)e.getWhoClicked();
Inventory inv = e.getInventory();
if(inv instanceof AnvilInventory) {
p.sendMessage("Anvil Inventory");
}else{
p.sendMessage("Other Inventory: "+inv.getType().name());
}
}
@EventHandler
public void onPrepareAnvil(PrepareAnvilEvent e){
AnvilInventory inv = e.getInventory();
Player p = (Player)e.getView().getPlayer();
p.sendMessage("Triggered PrepareAnvilEvent");
}
My final goal would be to create a custom text input GUI using a custom Anvil inventory with a custom InventoryHolder. But with these current problems, it make it impossible using the paper API.
https://github.com/PaperMC/Paper/assets/52638579/aac05216-b63e-41e8-8ec8-028253ae3799
If you want to open a custom anvil inventory for text input you need to use this method to open the inventory, although it does not support custom inventory holders
If you want to open a custom anvil inventory for text input you need to use this method to open the inventory, although it does not support custom inventory holders
Yes but with this you actually can't edit the displayed title text of the anvil, and like you said, you can't use custom Inventory Holders
Yes but with this you actually can't edit the displayed title text of the anvil, and like you said, you can't use custom Inventory Holders
Well you can, just in a round-a-bout way. Just listen to the InventoryOpenEvent and change the title there
Well there is still a PR open, that would finally make this easier :) (#9658)
What behaviour is expected:
What you expected to see paper api : open the anvil and use it ingame
What behaviour is observed:
What you actually saw i was kicked from the server when i use it: Packet processing error . And i saw a error in the console: https://pastebin.pl/view/49f4d75a
Steps/models to reproduce:
This may include a build schematic, a video, or detailed instructions to help reconstruct the issue open a anvil with the paper api, code: player.openInventory(Bukkit.createInventory(player, InventoryType.ANVIL)); use it and you see you are kicked because Packet procressing error. and in the console is a big error
Plugin list:
A list of your plugins https://i.imgur.com/f8edd3y.png -essentials is my plugin!
Paper version:
Paste the output of running
/version
on your server WITH the Minecraft version.latest
is not a version; we require the output of/version
so we can properly track down the issue. https://i.imgur.com/bXFo6ac.png