Posted October 11, 201510 yr Hello, I'm new to modding in minecraft and I was testing around with some events. I was wondering why ChunkDataEvent.Load never calls when loading into a map/server. @SubscribeEvent public void LoadChunk(ChunkDataEvent.Load event){ System.out.println("Chunk loaded x:" + event.getChunk().xPosition + " z:" + event.getChunk().zPosition); } Did I miss something? The console returns no errors and also the default Init event seems to work fine. Thanks for reading/helping!
October 11, 201510 yr This should be in modder support. Did you register your event class? Are other events also not called? 1.7.10 is no longer supported by forge, you are on your own.
October 11, 201510 yr Author What do you exactly mean? This is the full code I came up with so far: @EventHandler public void preInit(FMLPreInitializationEvent event) { FMLCommonHandler.instance().bus().register(new Events()); System.out.println("Event Handler Initialized"); } Events class looks like this: public class Events { @SubscribeEvent public void LoadChunk(ChunkDataEvent.Load event){ System.out.println("Chunk loaded x:" + event.getChunk().xPosition + " z:" + event.getChunk().zPosition); } }
October 11, 201510 yr MinecraftForge.EVENT_BUS.register(new ForgeEvents()); This event belongs to Forge events. To know that look at package. There are 2 main buses - FML and Forge, and few side ones - for world-gens mainly. 1.7.10 is no longer supported by forge, you are on your own.
October 19, 201510 yr Author Allright I got it working now on singleplayer with MinecraftForge.EVENT_BUS.register(new Events()); But for some reason none of these events call on multiplayer servers? Do I need another event for this? I'm working with world generating.
October 22, 201510 yr Author I figured out why it didn't seem to work on multiplayer servers. I was checking for stone blocks in the chunk and logging that to the console. It worked fine on singleplayer but for some reason on multiplayer the chunk.getBlock() only returns air blocks and finds nothing else. This is what I have tried: @SubscribeEvent public void LoadChunk(ChunkEvent.Load event){ for(int x = event.getChunk().xPosition*16; x<(event.getChunk().xPosition*16)+15; x++){ for(int y = 0; y < 256; y++){ for(int z = event.getChunk().zPosition*16; z<(event.getChunk().zPosition*16)+15; z++){ if(event.getChunk().getBlock(x,y,z) != Block.getBlockById(0)){ System.out.println("Block : " + x + "," + y + "," + z); } } } } } This code spams my console in multiplayer. If I change getBlockById to 1 it finds nothing in multiplayer and still works in singleplayer. Why does this happen?
October 23, 201510 yr Author What do you exactly mean with the constant of the block class? If I try: System.out.println(event.getChunk().getBlock(x,y,z).toString()); This still ends up spamming only air blocks like this: net.minecraft.block.BlockAir@503ecb24 If I'm right thats the constant of the block or isn't it?
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.