Jump to content

1.18.2 LivingChangeTargetEvent NoClassDef Error


sFXprt

Recommended Posts

As the title states I am trying to subscribe to LivingChangeTargetEvent but it cant find the definition, I tried different annotations and that didnt work. My current annotation isย 

@Mod.EventBusSubscriber(modid = Main.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)

And this is the method I'm using

@SubscribeEvent
    public static void onTarget(LivingChangeTargetEvent e){
        LivingEntity entity = e.getEntityLiving();
        if(entity.getPersistentData().contains(XprtData.GALAXUS_SLAVE)){
            if(!entity.getLevel().isClientSide()){
                ServerLevel lvl = (ServerLevel) entity.getLevel();
                UUID id = entity.getPersistentData().getUUID(XprtData.GALAXUS_SLAVE_OWNER);
                if(lvl.getPlayerByUUID(id)!=null){
                    Player p = lvl.getPlayerByUUID(id);
                    if(e.getNewTarget().equals(p) || e.getNewTarget().getId() == p.getId()){
                        e.setCanceled(true);
                    }
                }
            }
        }
    }

this is just a simple turn any entity to do ur bidding code and I remember in past projects using LivingChangeTargetEvent and it worked. Do I have to rebuild the entire project and run mappings updates or something??

By the way I am only using my mod and optifine(removing optifine doesnt change anything) and the debug.log just says what the title says.

Edited by sFXprt
Link to comment
Share on other sites

https://maven.minecraftforge.net/net/minecraftforge/forge/1.18.2-40.2.2/forge-1.18.2-40.2.2-changelog.txt

Quote

40.1.84 [1.18.x] Make LivingSetAttackTargetEvent compatible with the Brain/Behavior system. (#8918)

From what I understand that event was added during the above change.

The previously available LivingSetAttackTarget is currently marked as deprecated in 1.19 in favour of that new event.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.comย  You should also read the support forum sticky post.

Link to comment
Share on other sites

13 hours ago, warjort said:

https://maven.minecraftforge.net/net/minecraftforge/forge/1.18.2-40.2.2/forge-1.18.2-40.2.2-changelog.txt

From what I understand that event was added during the above change.

The previously available LivingSetAttackTarget is currently marked as deprecated in 1.19 in favour of that new event.

I am on version 40.2.0 still no class def, ill try to update to the latest

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



×
×
  • Create New...

Important Information

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