Railcraft

Railcraft

34M Downloads

Server crash when player has a Thruster from Futurepack in their inventory

Maxwell-lt opened this issue ยท 0 comments

commented

Description of the Bug
Server crash when a player has a Futurepack thruster in their inventory

To Reproduce

  1. Use creative menu (or the crafting recipe) to add a Thruster block from Futurepack to your inventory
  2. Server crashes with exception java.lang.IllegalArgumentException: Cannot set property PropertyInteger{name=metadata, clazz=class java.lang.Integer, values=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]} to 13 on block fp:triebwerk, it is not an allowed value

Expected behavior
The server does not crash.

Logs & Environment
Minimum environment to reproduce:

  • Minecraft 1.12.2
  • Forge 14.23.5.2854
  • Railcraft 12.0.0
  • Futurepack 1.12.2-26.4.89

Logs:

Additional context
The issue appears to be caused because Thrusters render facing upward in the inventory, but cannot by placed in that orientation as a block. Because of this, the call to getStateFromMeta(stack.getItemDamage()) fails. A fix is to catch IllegalArgumentException and return the default value of Blocks.AIR.getDefaultState() instead.