Topic category: Advanced modding
Scenario
I made an MCreator 2023.2 project using the Fabric plugin a few days ago and I want my block to react to redstone by changing blockstate. For this I need to import net.minecraft.world.World
and call World.setBlockState()
. I'm overriding neighborChanged()
in my class that extends Block. This is all strictly expected, vetted by my friend's code, online tutorials and references to these functions in multiple places.
Problem
Intellisense reports net.minecraft.world.World
does not exist (it has no entry for World
). Build fails on this, saying the symbol can't be found, but this should exist. Adding a procedure on neighbor changed and viewing its code reveals a weird discrepancy. The override for neighborChanged should be:public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos)
but is:public void neighborChanged(BlockState state, Level world, BlockPos pos, Block blockIn, BlockPos neighborBlock, boolean moving)
as registered by the procedure. The instance world
unsurprisingly doesn't have setBlockState()
.
Why doesn't net.minecraft.world.World
exist? How do I fix this? I did no manual tweaking outside this one block file. My mod is very small currently. My friend also made a brand new repo with the fabric plugin and encountered this issue, so let me know if this belongs on the MCreator issue tracker itself. Thank you in advance!
Same problem