1.21 Forge LivingChangeTargetEvent not working.

Started by RetroBuzz on

Topic category: Help with Minecraft modding (Java Edition)

Joined Dec 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
1.21 Forge LivingChangeTargetEvent not working.

So I am trying to make essentially a necromancer sorta thing and I can't seem to get the LivingChangeTargetEvent to work, I don't know much about events so I'm not sure if I am doing something wrong with the BusSubscriber or something? With this code and other various debug codes it never did or changed anything.

 

@Mod.EventBusSubscriber(modid = RSGArmoury.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE)
public class RSGEvents {


@SubscribeEvent
public void undeadArmyIgnore(LivingChangeTargetEvent event) {
if (event.getEntity() instanceof Player player) {
event.setNewTarget(null);
}
}