GeyserMC / Geyser

A bridge/proxy allowing you to connect to Minecraft: Java Edition servers with Minecraft: Bedrock Edition.
https://geysermc.org
MIT License
4.74k stars 686 forks source link

Item with CanPlaceOn:pink_wool is invisible, yet item with CanPlaceOn:dirt is ok #2426

Closed cssbz closed 3 years ago

cssbz commented 3 years ago

Describe the bug

The following commands differ only in the CanPlaceOn restriction. The first specifies a stone block which can only be placed on pink_wool, and this operates as expected. The second, where the stone block can only be placed on dirt, produces an invisible item from the Bedrock player's point of view.

OK:   /give .RubyNine3296661 minecraft:stone{CanPlaceOn:["minecraft:pink_wool"]}
FAIL: /give .RubyNine3296661 minecraft:stone{CanPlaceOn:["minecraft:dirt"]}

To Reproduce

OK: /give .RubyNine3296661 minecraft:stone{CanPlaceOn:["minecraft:pink_wool"]}

FAIL: /give .RubyNine3296661 minecraft:stone{CanPlaceOn:["minecraft:dirt"]}

I've also found a similar issue with CanDestroy and these items:

OK   /give .RubyNine3296661 minecraft:diamond_pickaxe{CanDestroy:["minecraft:blue_concrete"]}
FAIL /give .RubyNine3296661 minecraft:diamond_pickaxe{CanDestroy:["minecraft:glowstone"]}

This may not be quite the same issue... in the FAIL case here, the pickaxe is invisible (as with the stone block above), but it also seems that the pickaxe can't be used.

I've found these particular problematic CanPlaceOn / CanDestroy combinations by boiling down issues in two mini games. I have noticed that the OK cases here refer to items containing the underscore character, whereas the FAIL cases don't contain that character. I don't know if that's the case generally - I haven't looked for other similar cases, but I assume they will exist.

Expected behaviour

Please see the To Reproduce section.

Screenshots / Videos

No response

Server Version and Plugins

On this server, when I type /version in the Java or Bedrock client, I see "The server is running CraftBukkit version 3180-Spigot-38e6c03-ca0fe5b (MC: 1.17.1) (Implementing API version 1.17.1-R0.1-SNAPSHOT)".

I'm not the server owner and don't know all the details. Geyser is running in a Bungee proxy server. The owner has run /geyser dump - details below. I do know the owner well and can supply more detail if requested.

I do know that we isolated this bug on 18/07/2021, with an installed Geyser version from a few days before. We then updated Geyser on that day to the current version, and the issue persisted.

NB for the "Geyser Version" field in this bug report form below, I've found that detail from the Geyser Dump.

Geyser Dump

https://dump.geysermc.org/PjWiD0LsdOlUClvfn5cHzLim30HwTa72

Geyser Version

1.4.1-SNAPSHOT (git-master-0e72952)

Minecraft: Bedrock Edition Version

v1.17.10

Additional Context

The server owner has seen this error in the console (from the bungee proxy I believe), whilst I was testing.

12:04:44 [WARNING] [Geyser-BungeeCord] Could not translate packet ServerEntityMetadataPacket
java.lang.NullPointerException: Cannot invoke "String.replace(java.lang.CharSequence, java.lang.CharSequence)" because the return value of "org.geysermc.connector.registry.SimpleMappedRegistry.get(Object)" is null
    at org.geysermc.connector.network.translators.item.ItemTranslator.getCanModify(ItemTranslator.java:206)
    at org.geysermc.connector.network.translators.item.ItemTranslator.translateToBedrock(ItemTranslator.java:180)
    at org.geysermc.connector.entity.ItemEntity.updateBedrockMetadata(ItemEntity.java:77)
    at org.geysermc.connector.network.translators.java.entity.JavaEntityMetadataTranslator.translate(JavaEntityMetadataTranslator.java:53)
    at org.geysermc.connector.network.translators.java.entity.JavaEntityMetadataTranslator.translate(JavaEntityMetadataTranslator.java:38)
    at org.geysermc.connector.network.translators.PacketTranslatorRegistry.translate(PacketTranslatorRegistry.java:95)
    at org.geysermc.connector.network.session.GeyserSession$1.packetReceived(GeyserSession.java:807)
    at com.github.steveice10.packetlib.event.session.PacketReceivedEvent.call(PacketReceivedEvent.java:51)
    at com.github.steveice10.packetlib.tcp.TcpSession.callEvent(TcpSession.java:149)
    at com.github.steveice10.packetlib.tcp.TcpSession$2.run(TcpSession.java:321)
    at java.base/java.lang.Thread.run(Thread.java:831)
12:04:44 [SEVERE] java.lang.NullPointerException: Cannot invoke "String.replace(java.lang.CharSequence, java.lang.CharSequence)" because the return value of "org.geysermc.connector.registry.SimpleMappedRegistry.get(Object)" is null
12:04:44 [WARNING] [Geyser-BungeeCord] Error processing inventory task
java.lang.NullPointerException: Cannot invoke "String.replace(java.lang.CharSequence, java.lang.CharSequence)" because the return value of "org.geysermc.connector.registry.SimpleMappedRegistry.get(Object)" is null
    at org.geysermc.connector.network.translators.item.ItemTranslator.getCanModify(ItemTranslator.java:206)
    at org.geysermc.connector.network.translators.item.ItemTranslator.translateToBedrock(ItemTranslator.java:180)
    at org.geysermc.connector.inventory.GeyserItemStack.getItemData(GeyserItemStack.java:101)
    at org.geysermc.connector.inventory.Inventory.updateItemNetId(Inventory.java:114)
    at org.geysermc.connector.inventory.Inventory.setItem(Inventory.java:108)
    at org.geysermc.connector.network.translators.java.window.JavaSetSlotTranslator.lambda$translate$2(JavaSetSlotTranslator.java:90)
    at java.base/java.util.concurrent.CompletableFuture.uniRunNow(CompletableFuture.java:815)
    at java.base/java.util.concurrent.CompletableFuture.uniRunStage(CompletableFuture.java:799)
    at java.base/java.util.concurrent.CompletableFuture.thenRun(CompletableFuture.java:2191)
    at org.geysermc.connector.network.session.GeyserSession.addInventoryTask(GeyserSession.java:1084)
    at org.geysermc.connector.network.translators.java.window.JavaSetSlotTranslator.translate(JavaSetSlotTranslator.java:62)
    at org.geysermc.connector.network.translators.java.window.JavaSetSlotTranslator.translate(JavaSetSlotTranslator.java:57)
    at org.geysermc.connector.network.translators.PacketTranslatorRegistry.translate(PacketTranslatorRegistry.java:95)
    at org.geysermc.connector.network.session.GeyserSession$1.packetReceived(GeyserSession.java:807)
    at com.github.steveice10.packetlib.event.session.PacketReceivedEvent.call(PacketReceivedEvent.java:51)
    at com.github.steveice10.packetlib.tcp.TcpSession.callEvent(TcpSession.java:149)
    at com.github.steveice10.packetlib.tcp.TcpSession$2.run(TcpSession.java:321)
    at java.base/java.lang.Thread.run(Thread.java:831)
12:04:44 [SEVERE]     at org.geysermc.connector.network.translators.item.ItemTranslator.getCanModify(ItemTranslator.java:206)
12:04:44 [SEVERE]     at org.geysermc.connector.network.translators.item.ItemTranslator.translateToBedrock(ItemTranslator.java:180)
12:04:44 [SEVERE]     at org.geysermc.connector.entity.ItemEntity.updateBedrockMetadata(ItemEntity.java:77)
12:04:44 [SEVERE]     at org.geysermc.connector.network.translators.java.entity.JavaEntityMetadataTranslator.translate(JavaEntityMetadataTranslator.java:53)
12:04:44 [SEVERE]     at org.geysermc.connector.network.translators.java.entity.JavaEntityMetadataTranslator.translate(JavaEntityMetadataTranslator.java:38)
12:04:44 [SEVERE]     at org.geysermc.connector.network.translators.PacketTranslatorRegistry.translate(PacketTranslatorRegistry.java:95)
12:04:44 [SEVERE]     at org.geysermc.connector.network.session.GeyserSession$1.packetReceived(GeyserSession.java:807)
12:04:44 [SEVERE]     at com.github.steveice10.packetlib.event.session.PacketReceivedEvent.call(PacketReceivedEvent.java:51)
12:04:44 [SEVERE]     at com.github.steveice10.packetlib.tcp.TcpSession.callEvent(TcpSession.java:149)
12:04:44 [SEVERE]     at com.github.steveice10.packetlib.tcp.TcpSession$2.run(TcpSession.java:321)
12:04:44 [SEVERE]     at java.base/java.lang.Thread.run(Thread.java:831)
Camotoy commented 3 years ago

Thank you so much for the detailed report! Developers love that stuff. However, you're on an older Geyser build - this error has since been fixed; please download a newer build (and the one recommendation I would give is, if possible, to always update to the latest build of a plugin before reporting an error). The problem was a regression where we weren't handling Java -> Bedrock identifiers correctly if they were the same between the two platforms. Thanks for reporting anyway!

cssbz commented 3 years ago

Ooof! Thanks for the friendly reply!