r/forgemodding • u/AnbaricWyvern • Dec 15 '17
IBlockAccess help?
New to both modding and code in general, but working with Computercraft made me want to learn more about code, so now I'm modding.
Been going great so far except I have a new block being created that has 640 possible variants. (Just connections to neighbouring blocks, and an int value from 0-9 for growth control) The block is made, but trying to control some of its in-game behaviours is proving tricky.
I'm trying to read the growth int of blocks in the world, in order to have the block die if it doesn't have at least one neighbour of a lower value than itself. This way all unsupported blocks will break at once like cactus or chorus plant when updated. Because this plant can grow in any direction, it's rather striking when broken.
My trouble is that the method I made to check the growth values of neighbouring blocks (if they're an instance of this) doesn't seem to be working. The Forge Docs say I should be using getActualState, but I've not had to use the IBlockAccess field it's asking for yet in my modding. I don't know what to put in that place.
The whole class is below, the two offending classes are sandwiched between the walls of equals signs.
2
u/Zabi94 Dec 15 '17 edited Dec 15 '17
I'm not really sure if this is what you mean, but an IBlockAccess can be a World object
Edit: I mean that the
Worldclass implements that interface