bergerhealer / BKCommonLib

An extensive library used in bergerhealer's plugins
Other
181 stars 45 forks source link

NPE in BlockStateConversion#tileEntityToBlockState #37

Closed RyanHecht closed 7 years ago

RyanHecht commented 7 years ago
BkCommonLib version: 1.12.1-v1
Spigot version: 1.12.1 (5340a52)

Problem or bug:

Attempting to convert a Banner Tile Entity to its block state throws a NullPointerException

[19:41:12 ERROR]: [BKCommonLib] [Debug] Failed to convert net.minecraft.server.v1_12_R1.TileEntityBanner to CraftBlockState  -  com.bergerkiller.bukkit.common.conversion.type.BlockStateConversion.tileEntityToBlockState(BlockStateConversion.java:199)
java.lang.NullPointerException: null
        at org.bukkit.craftbukkit.v1_12_R1.block.CraftBanner.load(CraftBanner.java:38) ~[spigot1.12.1.jar:git-Spigot-5340a52-b587878]
        at org.bukkit.craftbukkit.v1_12_R1.block.CraftBanner.load(CraftBanner.java:1) ~[spigot1.12.1.jar:git-Spigot-5340a52-b587878]
        at org.bukkit.craftbukkit.v1_12_R1.block.CraftBlockEntityState.<init>(CraftBlockEntityState.java:27) ~[spigot1.12.1.jar:git-Spigot-5340a52-b587878]
        at org.bukkit.craftbukkit.v1_12_R1.block.CraftBanner.<init>(CraftBanner.java:22) ~[spigot1.12.1.jar:git-Spigot-5340a52-b587878]
        at org.bukkit.craftbukkit.v1_12_R1.block.CraftBlock.getState(CraftBlock.java:304) ~[spigot1.12.1.jar:git-Spigot-5340a52-b587878]
        at com.bergerkiller.bukkit.common.conversion.type.BlockStateConversion.tileEntityToBlockState(BlockStateConversion.java:185) [BKCommonLib-1.12.1.jar:?]
        at com.bergerkiller.bukkit.common.conversion.type.BlockStateConversion.tileEntityToBlockState(BlockStateConversion.java:175) [BKCommonLib-1.12.1.jar:?]
        at com.bergerkiller.bukkit.common.conversion.type.WrapperConversion.toBlockState(WrapperConversion.java:155) [BKCommonLib-1.12.1.jar:?]
        at com.bergerkiller.mountiplex.reflection.util.fast.GeneratedInvoker$mplgen77471267.invoke(Unknown Source) [?:?]
        at com.bergerkiller.mountiplex.reflection.util.FastMethod.invoke(FastMethod.java:122) [BKCommonLib-1.12.1.jar:?]
        at com.bergerkiller.mountiplex.conversion.type.DuplexConverter$DuplexAnnotatedConverter.convertInput(DuplexConverter.java:249) [BKCommonLib-1.12.1.jar:?]
        at com.bergerkiller.mountiplex.conversion.Converter.convert(Converter.java:58) [BKCommonLib-1.12.1.jar:?]
        at com.bergerkiller.mountiplex.conversion.Converter.convert(Converter.java:37) [BKCommonLib-1.12.1.jar:?]
        at com.bergerkiller.mountiplex.conversion.util.ConvertingIterator.next(ConvertingIterator.java:30) [BKCommonLib-1.12.1.jar:?]

Expected behaviour:

For the error not to be thrown and the BlockState to be converted successfully.

Steps to reproduce:

My specific stacktrace came from running WorldUtil#getBlockStates on a chunk containing a banner

RyanHecht commented 7 years ago

Looks like this was a Spigot issue that has been fixed: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/e1f296d115cfd2c517413d122990033fc1eda78d#src/main/java/org/bukkit/craftbukkit/block/CraftBanner.java