CloudburstMC / Nukkit

Cloudburst Nukkit - Nuclear-Powered Minecraft: Bedrock Edition Server Software
https://cloudburstmc.org
GNU General Public License v3.0
1.22k stars 419 forks source link

Quick crafting throws exception #231

Closed ghost closed 4 years ago

ghost commented 6 years ago

Expected Behavior

Get wood, craft into planks; craft a crafting table.

Actual Behavior

Server throws alert; crafting table appears in inventory but when chosen, vanishes to be replaced with planks.

Steps to Reproduce

Create a new world + server using build 152, get logs, make into planks, craft table.

Debug information

22:49:18 [ALERT] java.lang.ArrayIndexOutOfBoundsException: 1
        at cn.nukkit.inventory.ShapedRecipe.matchInputMap(ShapedRecipe.java:227)
        at cn.nukkit.inventory.ShapedRecipe.matchItems(ShapedRecipe.java:171)
        at cn.nukkit.inventory.CraftingManager.matchRecipe(CraftingManager.java:307)
        at cn.nukkit.inventory.transaction.CraftingTransaction.canExecute(CraftingTransaction.java:141)
        at cn.nukkit.inventory.transaction.InventoryTransaction.execute(InventoryTransaction.java:275)
        at cn.nukkit.inventory.transaction.CraftingTransaction.execute(CraftingTransaction.java:175)
        at cn.nukkit.Player.handleDataPacket(Player.java:2796)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1378)
        at cn.nukkit.network.Network.processPackets(Network.java:178)
        at cn.nukkit.network.Network.processBatch(Network.java:160)
        at cn.nukkit.Player.handleDataPacket(Player.java:2022)
        at cn.nukkit.network.RakNetInterface.handleEncapsulated(RakNetInterface.java:157)
        at cn.nukkit.raknet.server.ServerHandler.handlePacket(ServerHandler.java:132)
        at cn.nukkit.network.RakNetInterface.process(RakNetInterface.java:66)
        at cn.nukkit.network.Network.processInterfaces(Network.java:76)
        at cn.nukkit.Server.tick(Server.java:1074)
        at cn.nukkit.Server.tickProcessor(Server.java:848)
        at cn.nukkit.Server.start(Server.java:825)
        at cn.nukkit.Server.<init>(Server.java:508)
        at cn.nukkit.Nukkit.main(Nukkit.java:99)
ghost commented 6 years ago

Problem persists with Build 154.

To be clear, this is a new folder with new files, no corruption brought from existing. Playing in survival mode.

22:21:48 [ALERT] java.lang.ArrayIndexOutOfBoundsException: 1
    at cn.nukkit.inventory.ShapedRecipe.matchInputMap(ShapedRecipe.java:227)
    at cn.nukkit.inventory.ShapedRecipe.matchItems(ShapedRecipe.java:171)
    at cn.nukkit.inventory.CraftingManager.matchRecipe(CraftingManager.java:307)
    at cn.nukkit.inventory.transaction.CraftingTransaction.canExecute(CraftingTransaction.java:141)
    at cn.nukkit.inventory.transaction.InventoryTransaction.execute(InventoryTransaction.java:275)
    at cn.nukkit.inventory.transaction.CraftingTransaction.execute(CraftingTransaction.java:175)
    at cn.nukkit.Player.handleDataPacket(Player.java:2796)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1378)
    at cn.nukkit.network.Network.processPackets(Network.java:178)
    at cn.nukkit.network.Network.processBatch(Network.java:160)
    at cn.nukkit.Player.handleDataPacket(Player.java:2022)
    at cn.nukkit.network.RakNetInterface.handleEncapsulated(RakNetInterface.java:157)
    at cn.nukkit.raknet.server.ServerHandler.handlePacket(ServerHandler.java:132)
    at cn.nukkit.network.RakNetInterface.process(RakNetInterface.java:66)
    at cn.nukkit.network.Network.processInterfaces(Network.java:76)
    at cn.nukkit.Server.tick(Server.java:1074)
    at cn.nukkit.Server.tickProcessor(Server.java:848)
    at cn.nukkit.Server.start(Server.java:825)
    at cn.nukkit.Server.<init>(Server.java:508)
    at cn.nukkit.Nukkit.main(Nukkit.java:99)
SupremeMortal commented 6 years ago

I am unable to reproduce this. Please give precise steps on how you reproduced this bug.

lucascaro commented 6 years ago

Just installed in linux 32 bit and got the same problem (using latest artifact from build #178)

java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) Client VM (build 25.65-b01, mixed mode)

repro steps:

  1. start the server (empty fresh start without an existing world)
  2. log in
  3. get wood and build crafting table

result: the following server error and the crafting table disappears:

 ./start.sh
Using log level 'INFO'
20:21:14 [INFO] Loading nukkit.yml...
20:21:15 [INFO] Loading server properties...
20:21:15 [INFO] Selected English (eng) as the base language
20:21:15 [INFO] Starting Minecraft: PE server version v1.4
20:21:15 [INFO] Selected Zlib Provider: 2 (cn.nukkit.utils.ZlibThreadLocal)
20:21:15 [INFO] Opening server on 0.0.0.0:19132
20:21:15 [INFO] This server is running Nukkit version 1.0dev "蘋果(Apple)派(Pie)" (API 1.0.6)
20:21:15 [INFO] Nukkit is distributed under the LGPL License
20:21:17 [INFO] Loading recipes...
20:21:18 [INFO] Loaded 954 recipes.
20:21:18 [INFO] Successfully loaded 0 resource packs
> Java HotSpot(TM) Client VM warning: You have loaded library /tmp/libnetty-transport-native-epoll5176251956890241038.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
20:21:18 [INFO] Preparing level "world"
20:21:18 [ALERT] No level called "nether" found! Nether functionality will be disabled.
20:21:18 [INFO] Starting GS4 status listener
20:21:18 [INFO] Setting query port to 19132
20:21:18 [INFO] Query is running on 0.0.0.0:19132
20:21:18 [INFO] Default game type: Survival Mode
20:21:18 [INFO] Done (4.714s)! For help, type "help" or "?"
20:21:18 [INFO] Epoll is unavailable. Reverting to NioEventLoop.
20:21:30 [INFO] RealPalangano[/192.168.86.30:51001] logged in with entity id 1 at (world, 191.8747, 67.0, 262.2279)
20:21:31 [INFO] RealPalangano joined the game
20:21:36 [ALERT] java.lang.ArrayIndexOutOfBoundsException: 1
        at cn.nukkit.inventory.ShapedRecipe.matchInputMap(ShapedRecipe.java:227)
        at cn.nukkit.inventory.ShapedRecipe.matchItems(ShapedRecipe.java:171)
        at cn.nukkit.inventory.CraftingManager.matchRecipe(CraftingManager.java:303)
        at cn.nukkit.inventory.transaction.CraftingTransaction.canExecute(CraftingTransaction.java:141)
        at cn.nukkit.inventory.transaction.InventoryTransaction.execute(InventoryTransaction.java:275)
        at cn.nukkit.inventory.transaction.CraftingTransaction.execute(CraftingTransaction.java:175)
        at cn.nukkit.Player.handleDataPacket(Player.java:2808)
        at java.util.ArrayList.forEach(ArrayList.java:1249)
        at cn.nukkit.network.Network.processPackets(Network.java:178)
        at cn.nukkit.network.Network.processBatch(Network.java:160)
        at cn.nukkit.Player.handleDataPacket(Player.java:2026)
        at cn.nukkit.network.RakNetInterface.handleEncapsulated(RakNetInterface.java:157)
        at cn.nukkit.raknet.server.ServerHandler.handlePacket(ServerHandler.java:132)
        at cn.nukkit.network.RakNetInterface.process(RakNetInterface.java:66)
        at cn.nukkit.network.Network.processInterfaces(Network.java:76)
        at cn.nukkit.Server.tick(Server.java:1076)
        at cn.nukkit.Server.tickProcessor(Server.java:850)
        at cn.nukkit.Server.start(Server.java:827)
        at cn.nukkit.Server.<init>(Server.java:510)
        at cn.nukkit.Nukkit.main(Nukkit.java:99)

20:21:47 [INFO] RealPalangano left the game
20:21:47 [INFO] RealPalangano[/192.168.86.30:51001] logged out due to client disconnect
lucascaro commented 6 years ago

update: I was able to make the crafting table manually, the crash happens only when using recipes to craft it.

wordandahalf commented 5 years ago

Can confirm this on master @ ef38848 Since the previous steps to reproduce are a little vague:

  1. Chop log (any type will do)
  2. Craft log into planks (manually or using the left panel in the inventory)
  3. Use the left panel to automatically craft a crafting table

java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1 at cn.nukkit.inventory.ShapedRecipe.matchInputMap(ShapedRecipe.java:241) ~[classes/:?] at cn.nukkit.inventory.ShapedRecipe.matchItems(ShapedRecipe.java:196) ~[classes/:?] at cn.nukkit.inventory.CraftingManager.matchRecipe(CraftingManager.java:344) ~[classes/:?] at cn.nukkit.inventory.transaction.CraftingTransaction.canExecute(CraftingTransaction.java:133) ~[classes/:?] at cn.nukkit.inventory.transaction.InventoryTransaction.execute(InventoryTransaction.java:276) ~[classes/:?] at cn.nukkit.inventory.transaction.CraftingTransaction.execute(CraftingTransaction.java:167) ~[classes/:?] at cn.nukkit.Player.handleDataPacket(Player.java:2909) ~[classes/:?] at java.util.ArrayList.forEach(ArrayList.java:1540) ~[?:?] at cn.nukkit.network.Network.processPackets(Network.java:186) ~[classes/:?] at cn.nukkit.network.Network.processBatch(Network.java:168) [classes/:?] at cn.nukkit.Player.handleDataPacket(Player.java:2075) [classes/:?] at cn.nukkit.network.RakNetInterface.handleEncapsulated(RakNetInterface.java:157) [classes/:?] at cn.nukkit.raknet.server.ServerHandler.handlePacket(ServerHandler.java:132) [classes/:?] at cn.nukkit.network.RakNetInterface.process(RakNetInterface.java:66) [classes/:?] at cn.nukkit.network.Network.processInterfaces(Network.java:77) [classes/:?] at cn.nukkit.Server.tick(Server.java:1124) [classes/:?] at cn.nukkit.Server.tickProcessor(Server.java:903) [classes/:?] at cn.nukkit.Server.start(Server.java:880) [classes/:?] at cn.nukkit.Server.<init>(Server.java:565) [classes/:?] at cn.nukkit.Nukkit.main(Nukkit.java:112) [classes/:?]