-
Posts
2 -
Joined
-
Last visited
Posts posted by ShinkoNet
-
-
Hi.
I am currently updating an abandoned java/scala coremod. The java part compiles fine, but the scala bit has a compile error in 1.12.
:compileScala [ant:scalac] C:\Users\Shinko\Desktop\MCNBS\Modding\NoteBetter-2-master\build\sources\main\scala\com\github\soniex2\notebetter\note\InstrumentBlock.scala:27: error: value getPropertyNames is not a member of net.minecraft.block.state.IBlockState [ant:scalac] state.getPropertyNames.asScala.flatMap((p) => v._1.get(p.getName).map((p, _))).forall((x) => x._2.contains(state.getValue(x._1).toString)) [ant:scalac] ^ [ant:scalac] one error found
The changelog doesn't say anything about block states being changed, and the mod used to compile fine in 1.11.2.
This is the code in question. It's purpose, I think, is for it to get the name of the instrument, filter the data, and adds it to the instrument list, but I could be wrong as I am more familiar with Java than Scala.
def get(state: IBlockState): Option[NoteBetterInstrument] = { _predicates.find((v) => { state.getPropertyNames.asScala.flatMap((p) => v._1.get(p.getName).map((p, _))).forall((x) => x._2.contains(state.getValue(x._1).toString)) }).map(_._2) }
What is the current alternative to this function, since I cannot use it with IBlockState anymore?
Thanks!
[1.12] [Scala] getPropertyNames no longer part of IBlockState?
in Modder Support
Posted
Thanks, the mod now compiles fine and works as intended!
I'll make sure to use that bot in the future!