Jump to content

[1.13.2] Events not firing


Meldexun
 Share

Recommended Posts

Hello there,

i want to use some events in my mod but all of them don't seem to work.

So this is an example class:

@EventBusSubscriber(modid = BetterDiving.MOD_ID)
public class Test {
    
    @SubscribeEvent
    public static void test1(PlayerInteractEvent.RightClickEmpty e) {
        System.out.println("Test1");
    }
    
    @SubscribeEvent
    public static void test2(LivingUpdateEvent e) {
        System.out.println("Test2");
    }
    
}

 

Am i missing something?

Edited by Meldexun
Link to comment
Share on other sites

Okay, that wasn't the issue. Just another problem.

The problem was that i had a static ResourceLocation in one of my event classes. So when you have a class with the EventBusSubscriber annotation and inside it a static ResourceLocation it will prevent all events from firing.

That would be an example class:

@EventBusSubscriber(modid = TestMod.MOD_ID)
public class Test {
	
	public static ResourceLocation TEST = new ResourceLocation(TestMod.MOD_ID, "test");
	
}

 

Link to comment
Share on other sites

4 hours ago, diesieben07 said:

Yeah, no. This is not a thing at all.

I know it sounds like i'm just dumb. But these are my classes:

Mod class:

package meldexun.better_diving;

import net.minecraftforge.fml.common.Mod;

@Mod(BetterDiving.MOD_ID)
public class BetterDiving {
	
	public static final String MOD_ID = "better_diving";
	
}

 

Event class 1:

package meldexun.better_diving;

import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;

@EventBusSubscriber(modid = BetterDiving.MOD_ID)
public class Event1 {
	
	public static final ResourceLocation DIVING_VALUES = new ResourceLocation(BetterDiving.MOD_ID, "divingValues");
	
}

 

Event class 2:

package meldexun.better_diving;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;

@EventBusSubscriber(modid = BetterDiving.MOD_ID)
public class Event2 {
	
	@SubscribeEvent
	public static void test(LivingUpdateEvent e) {
		if (e.getEntity() instanceof EntityPlayer) {
			System.out.println("test");
		}
	}
	
}

 

When launching the game like this i never see the "test" from the LivingUpdateEvent.

But when removing the ResourceLocation from the Event class 1 i get the "test" in the console.

Edited by Meldexun
Link to comment
Share on other sites

Look at the code that creates event subscribers. There is nothing at all that deals with unsubscribing stuff with a resource location field.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

6 hours ago, Cadiboo said:

Look at the code that creates event subscribers. There is nothing at all that deals with unsubscribing stuff with a resource location field.

Well I'm just saying what is happening. These are the only 3 classes in my mod and only when i remove the ResourceLocation i get the "test" printed in the console. I really would like to understand what is causing this.

Link to comment
Share on other sites

Almost certainly something else is happening. After removing the line, and it works, add the line back, touch nothing else. Does it break again? Try commenting the line instead of removing it. Try changing the strings being passed to the resource location. Make it private. Don't make it static.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

59 minutes ago, Meldexun said:

Ok, i think i found it. I had a capital letter in my ResourceLocation which only gives an error but no crash and prevents the events from being subscribed.

Yes, because when it errors it stops loading your mod for being improperly formatted. This is not a "stop the presses and burn down the building" error, its a "throw the drunk out" error.

Edited by Draco18s
  • Haha 2

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello, is there some way to completely disable some dimensions for them to not load while server startup? Some event i can cancel or some setting?
    • [01:12:23] [01:12:23] [main/INFO]: ModLauncher running: args [--username, ytjasonsas, --version, release minecraft modde, --gameDir, C:\Users\jason\AppData\Roaming\.minecraft\versions\release minecraft modde, --assetsDir, C:\Users\jason\AppData\Roaming\.minecraft\assets, --assetIndex, 1.16, --uuid, 281b40fd-958f-11eb-90a8-d45d64bce613, --accessToken, ????????, --userType, mojang, --versionType, release, --width, 925, --height, 530, --launchTarget, fmlclient, --fml.forgeVersion, 36.2.39, --fml.mcVersion, 1.16.5, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20210115.111550] [main/INFO]: ModLauncher 8.1.3+8.1.3+main-8.1.x.c94d18ec starting: java version 1.8.0_51 by Oracle Corporation [01:12:23] [main/WARN]: LEGACY JDK DETECTED, SECURED JAR HANDLING DISABLED [01:12:23] [main/INFO]: Added Lets Encrypt root certificates as additional trust [01:12:23] [main/INFO]: SpongePowered MIXIN Subsystem Version=0.8.4 Source=file:/C:/Users/jason/AppData/Roaming/.minecraft/libraries/org/spongepowered/mixin/0.8.4/mixin-0.8.4.jar Service=ModLauncher Env=CLIENT [01:12:25] [main/INFO]: Launching target 'fmlclient' with arguments [--version, release minecraft modde, --gameDir, C:\Users\jason\AppData\Roaming\.minecraft\versions\release minecraft modde, --assetsDir, C:\Users\jason\AppData\Roaming\.minecraft\assets, --uuid, 281b40fd-958f-11eb-90a8-d45d64bce613, --username, ytjasonsas, --assetIndex, 1.16, --accessToken, ????????, --userType, mojang, --versionType, release, --width, 925, --height, 530] [01:12:30] [main/INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD' [01:12:30] [main/INFO]: Setting user: ytjasonsas [01:12:31] [main/INFO]: Backend library: LWJGL version 3.2.2 build 10 [01:12:32] [main/FATAL]: Error during pre-loading phase net.minecraftforge.fml.ModLoadingException: fml.modloading.dupedmod     at net.minecraftforge.fml.ModLoadingException.lambda$fromEarlyException$0(ModLoadingException.java:50) ~[?:?]     at net.minecraftforge.fml.ModLoadingException$$Lambda$2937/1237743088.apply(Unknown Source) ~[?:?]     at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) ~[?:1.8.0_51]     at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374) ~[?:1.8.0_51]     at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:512) ~[?:1.8.0_51]     at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502) ~[?:1.8.0_51]     at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) ~[?:1.8.0_51]     at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) ~[?:1.8.0_51]     at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_51]     at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418) ~[?:1.8.0_51]     at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:270) ~[?:1.8.0_51]     at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374) ~[?:1.8.0_51]     at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:512) ~[?:1.8.0_51]     at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:502) ~[?:1.8.0_51]     at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[?:1.8.0_51]     at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_51]     at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[?:1.8.0_51]     at net.minecraftforge.fml.ModLoader.<init>(ModLoader.java:106) ~[?:?]     at net.minecraftforge.fml.ModLoader.get(ModLoader.java:140) [?:?]     at net.minecraftforge.fml.client.ClientModLoader.lambda$begin$1(ClientModLoader.java:89) [?:?]     at net.minecraftforge.fml.client.ClientModLoader$$Lambda$2934/873769155.run(Unknown Source) [?:?]     at net.minecraftforge.fml.client.ClientModLoader.lambda$createRunnableWithCatch$4(ClientModLoader.java:109) [?:?]     at net.minecraftforge.fml.client.ClientModLoader$$Lambda$2935/919376773.run(Unknown Source) [?:?]     at net.minecraftforge.fml.client.ClientModLoader.begin(ClientModLoader.java:89) [?:?]     at net.minecraft.client.Minecraft.<init>(Minecraft.java:437) [?:?]     at net.minecraft.client.main.Main.main(Main.java:149) [?:?]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_51]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_51]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_51]     at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_51]     at net.minecraftforge.fml.loading.FMLClientLaunchProvider.lambda$launchService$0(FMLClientLaunchProvider.java:37) [forge-1.16.5-36.2.39.jar:36.2]     at net.minecraftforge.fml.loading.FMLClientLaunchProvider$$Lambda$416/1445758842.call(Unknown Source) [forge-1.16.5-36.2.39.jar:36.2]     at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-8.1.3.jar:?]     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-8.1.3.jar:?]     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-8.1.3.jar:?]     at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [modlauncher-8.1.3.jar:?]     at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [modlauncher-8.1.3.jar:?] [01:12:32] [main/ERROR]: Cowardly refusing to send event net.minecraftforge.client.event.sound.SoundLoadEvent to a broken mod state [01:12:32] [main/ERROR]: Cowardly refusing to send event net.minecraftforge.client.event.ColorHandlerEvent$Block to a broken mod state [01:12:32] [main/ERROR]: Cowardly refusing to send event net.minecraftforge.client.event.ColorHandlerEvent$Item to a broken mod state [01:12:34] [main/ERROR]: Cowardly refusing to send event net.minecraftforge.client.event.ParticleFactoryRegisterEvent to a broken mod state [01:12:34] [main/INFO]: Narrator library for x64 successfully loaded [01:12:34] [main/INFO]: Reloading ResourceManager: Default [01:12:34] [Worker-Main-8/ERROR]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state [01:12:34] [Worker-Main-9/ERROR]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state [01:12:34] [Worker-Main-12/ERROR]: Cowardly refusing to send event net.minecraftforge.client.event.ModelRegistryEvent to a broken mod state [01:12:34] [Worker-Main-10/ERROR]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state [01:12:37] [Worker-Main-12/ERROR]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state [01:12:38] [Worker-Main-12/ERROR]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state [01:12:38] [Worker-Main-12/ERROR]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state [01:12:38] [Worker-Main-12/ERROR]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state [01:12:38] [Worker-Main-12/ERROR]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state [01:12:38] [Worker-Main-12/ERROR]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state [01:12:38] [Worker-Main-12/ERROR]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Pre to a broken mod state [01:12:38] [main/INFO]: OpenAL initialized. [01:12:38] [main/INFO]: Sound engine started [01:12:39] [main/INFO]: Created: 1024x512x4 minecraft:textures/atlas/blocks.png-atlas [01:12:39] [main/ERROR]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state [01:12:39] [main/INFO]: Created: 256x128x4 minecraft:textures/atlas/signs.png-atlas [01:12:39] [main/ERROR]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state [01:12:39] [main/INFO]: Created: 512x512x4 minecraft:textures/atlas/banner_patterns.png-atlas [01:12:39] [main/ERROR]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state [01:12:39] [main/INFO]: Created: 512x512x4 minecraft:textures/atlas/shield_patterns.png-atlas [01:12:39] [main/ERROR]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state [01:12:39] [main/INFO]: Created: 256x256x4 minecraft:textures/atlas/chest.png-atlas [01:12:39] [main/ERROR]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state [01:12:39] [main/INFO]: Created: 512x256x4 minecraft:textures/atlas/beds.png-atlas [01:12:39] [main/ERROR]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state [01:12:39] [main/INFO]: Created: 512x256x4 minecraft:textures/atlas/shulker_boxes.png-atlas [01:12:39] [main/ERROR]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state [01:12:40] [main/ERROR]: Cowardly refusing to send event net.minecraftforge.client.event.ModelBakeEvent to a broken mod state [01:12:40] [main/INFO]: Created: 256x256x0 minecraft:textures/atlas/particles.png-atlas [01:12:40] [main/ERROR]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state [01:12:40] [main/INFO]: Created: 256x256x0 minecraft:textures/atlas/paintings.png-atlas [01:12:40] [main/ERROR]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state [01:12:40] [main/INFO]: Created: 128x128x0 minecraft:textures/atlas/mob_effects.png-atlas [01:12:40] [main/ERROR]: Cowardly refusing to send event net.minecraftforge.client.event.TextureStitchEvent$Post to a broken mod state [01:12:40] [main/INFO]: [net.minecraft.crash.CrashReport:func_85057_a:196]: Negative index in crash report handler (23/26) [01:12:40] [main/FATAL]: Crash report saved to C:\Users\jason\AppData\Roaming\.minecraft\versions\release minecraft modde\crash-reports\crash-2022-12-09_01.12.40-fml.txt
    • Change your max fps to be larger than 0, either in the options menu or the options.txt
    • Solved, didn't see the inventoryTick method before writing this.
    • Problem solved . The mods need to be updated to the 1.19.3 version and rightly . The mods citadel, better animal plus , journey map all works fine . Only architectury doesn’t work even after the update . I sent them a message to make them aware of the situation . 
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.