Posted April 20, 20205 yr My BlockState became too complicated for the values I wanted to feed into my IBlockColor#getColor() implementation. Is there any alternative to getting values from the BlockState, or will I have to use a TER/TESR? Edited April 20, 20205 yr by Jipthechip
April 20, 20205 yr 27 minutes ago, Jipthechip said: My BlockState became too complicated for the values I wanted to feed into my IBlockColor#getColor() implementation. Is there any alternative to getting values from the BlockState, or will I have to use a TER/TESR? I'm not sure if this still works, but you might be able to cast the ILightReader to a World(do an instanceof check it can be null). Then if it is use World::getTileEntity and store your colors in the TileEntity. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
April 20, 20205 yr 6 hours ago, diesieben07 said: No need for the cast, ILightReader extends IBlockReader, which has getTileEntity. Ah ok I didn't get that from the name, and didn't check either. Either way they still have to check for null. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
April 20, 20205 yr Author 13 hours ago, Animefan8888 said: I'm not sure if this still works, but you might be able to cast the ILightReader to a World(do an instanceof check it can be null). Then if it is use World::getTileEntity and store your colors in the TileEntity. 6 hours ago, diesieben07 said: No need for the cast, ILightReader extends IBlockReader, which has getTileEntity. Not casting it worked, but I tried casting it anyway just to see what would happen and it crashed. It gave the error: java.lang.ClassCastException: net.minecraft.client.renderer.chunk.ChunkRenderCache cannot be cast to net.minecraft.world.World
April 20, 20205 yr 1 minute ago, Jipthechip said: but I tried casting it anyway just to see what would happen and it crashed. It gave the error: 13 hours ago, Animefan8888 said: (do an instanceof check Also it can be null make sure it is not null before you use it. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
April 20, 20205 yr Author Just now, Animefan8888 said: Also it can be null make sure it is not null before you use it. 13 hours ago, Animefan8888 said: (do an instanceof check it can be null). I did that, and it just ended up never getting to the code I wanted it to.
April 20, 20205 yr 1 minute ago, Jipthechip said: I did that, and it just ended up never getting to the code I wanted it to. Which means I was wrong about it being a World instance when you need it to be. 13 hours ago, Animefan8888 said: I'm not sure if this still works, but you might be able to cast the ILightReader to a World VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
April 20, 20205 yr Author 1 hour ago, diesieben07 said: Show your code. My code was just this assert lightReader != null; assert pos != null; if(lightReader instanceof World){ // misc code never reached }else{ return MaterialColor.WATER.colorValue; } Like I said, not casting the ILightReader worked just fine. I was just curious if it could be cast to a World, and it doesn't seem like it can. Edited April 20, 20205 yr by Jipthechip
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.