-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect inventory sent when replacing an existing chest | PMMP 4.18 #207
Comments
Hi, can you explain what the bug is and what the video demonstrates? |
When you try to open a GUI, if a chest is nearby, the interface that opens is "bug". The video shows a player trying to open a GUI by tapping on a minion, he gets a double empty chest, but by pressing the slots, the real interface appears. |
Look the video 2023-03-31.15-26-42.mp4 |
Hello @Muqsit , any news ? |
I have been able to reproduce this bug on my end, but due to time constraints I am unable to work on a nice way to address it. protected function onEnable() : void{
if(!InvMenuHandler::isRegistered()){
InvMenuHandler::register($this);
}
+ $registry = InvMenuHandler::getTypeRegistry();
+ $registry->register(InvMenu::TYPE_CHEST, new class($registry->get(InvMenu::TYPE_CHEST)) implements InvMenuType{
+ public function __construct(
+ private InvMenuType $inner
+ ){}
+ public function createGraphic(InvMenu $menu, Player $player) : ?InvMenuGraphic{
+ $parent = $this->inner->createGraphic($menu, $player);
+ if(!($parent instanceof PositionedInvMenuGraphic)){
+ return null;
+ }
+ // Workaround for https://github.com/Muqsit/InvMenu/issues/207
+ // Set block at east and west of InvMenu::TYPE_CHEST to air.
+ $pos = $parent->getPosition();
+ return new MultiBlockInvMenuGraphic([
+ $parent,
+ new BlockInvMenuGraphic(VanillaBlocks::AIR(), $pos->east(), null, 0),
+ new BlockInvMenuGraphic(VanillaBlocks::AIR(), $pos->west(), null, 0)
+ ]);
+ }
+ public function createInventory() : Inventory{
+ return $this->inner->createInventory();
+ }
+ });
} An example script plugin using this workaround is listed here: https://gist.github.com/Muqsit/18400e53b132d166f13189e7f316658e |
I tried this workaround but it didn't work, the bug still occurs. |
The workaround fixes it but my suggestion is this method:- if a block already exists find another spot to set the block |
Hello, I have a bug with your code and PMMP v.4.18
RPReplay_Final1680089941.mov
RPReplay_Final1680089970.mov
The text was updated successfully, but these errors were encountered: