sFXprt Posted May 4, 2023 Posted May 4, 2023 (edited) 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 May 4, 2023 by sFXprt Quote
warjort Posted May 4, 2023 Posted May 4, 2023 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. Quote 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.
sFXprt Posted May 5, 2023 Author Posted May 5, 2023 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 Quote
Recommended Posts
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.