BlockManager returns Air block instead of null for block family if no side is defined
See original GitHub issueTo test,
inject a BlockManager in a test system, activate the core module and inspect
blockManager.getBlock("core:BirchTrunk:engine:stair")
. This call is missing the side parameter for the family rotation, e.g. blockManager.getBlock("core:BirchTrunk:engine:stair.LEFT")
gives a correct rotated stair.
But instead of logging an error or returning null, this silently returns an Air block 😒 .
Tow classes on issue here:
HorizontalBlockFamily.getBlockFor(BlockUri)
does not log an warning when the side can not be parsed, returning null may be okay.
BlockManager.getBlock(BlockUri)
returns null if the block can not be found directly but an air block if the block is not directly registered, part of a family and the family returns null for the block. This should really return null as the javadoc says: Retrieves the Block for the given uri, or null if there isn't one
.
Issue Analytics
- State:
- Created 6 years ago
- Comments:21 (17 by maintainers)
Top GitHub Comments
I vote for Optional.
If the goal is to make the most efficient code we possibly can, we should switch to C++ (or assembly). However, the goal is to make a easy-to-approach, extensible platform. Which is why I vote in favour of cleaner code, even if it means slight performance hit. (Note that gestalt uses Optionals almost exclusively, so any and every cost associated with Optionals is already being borne by us.)
I personally really like Scala, it does its typing system Right, but it is not really ‘first-class’ in that it is not native on anything yet, has to be separate. Kotlin is more of a very simplified Scala, lacks the nice typing features of Scala so you cannot generate, say, super-optimized code (like primitive containers and such), but it is more of a Java Done Right, but the big point of it is that it is First-Class on Android, and if it is first class there (the largest JVM ecosystem) and the largest Java IDE (IntelliJ) includes Kotlin by default for the desktop, it is likely to say that it has become pretty ubiquitous (didn’t Kotlin even take over Java in the last few months as the most used JVM language on android?). Scala’s code generation is absolutely top notch though… hard to ignore that…
But yeah, Scala and Kotlin and Java can all interoperate fine in all ways without cost (unlike groovy and such).
There shouldn’t be any hoops to jump through if Scala/Kotlin is added to the base engine’s gradle file, it will set up the scala/kotlin for whatever IDE they use anyway.