Topic category: Help with Minecraft modding (Java Edition)
C:\Users\-\MCreatorWorkspaces\superior_tnt\src\main\java\net\mcreator\superiortnt\SuperiorTNTEventHandler.java:24: error: package net.minecraftforge.event.world does not exist
import net.minecraftforge.event.world.ChunkEvent;
^
C:\Users\-\MCreatorWorkspaces\superior_tnt\src\main\java\net\mcreator\superiortnt\SuperiorTNTEventHandler.java:37: error: package ChunkEvent does not exist
public static void chunkLoaded(ChunkEvent.Load event) {
^
2 errors
FAILURE: Build failed with an exception.
I'm getting this error, I'm trying to make an event which will occur whenever a chunk is loaded, but it says the package for ChunkEvent does not exist.
Are you using custom code? In this case, make sure the code you are copying is for the right Minecraft version
I managed to fix this part, I just had incorrect imports, but now I'm running into a new problem, it says that my chunkLoaded method:
has @subscribeEvent annotation, but takes an argument that is not a subtype of the base type interface net.minecraftforge.fml.event.IModBusEvent: class net.minecraftforge.event.level.ChunkEvent$Load
And this is confusing me because I'm getting help from a friend of mine and he says that he put the same code outside MCreator and it works fine
My method:
Yes it's custom code
It fully depends where you put the trigger, whether it is static or not and what event bus it is on.
If you want to do custom code, I suggest learning Forge event system fully first. This may help: https://docs.minecraftforge.net/en/latest/concepts/events/
It works now, I solved it by not using a custom element, and making the class myself.