Jump to content

[1.7.10] getDamageSource() returns null on multiplayer


Fury

Recommended Posts

I'm making a mod called BadManners. Whenever you kill someone it sends a message with their name in it and follows with an "ez". Yes, I know I'm working in an ANCIENT version, but this version is most commonly used for PvP and the mod is directed towards the PvP community. 

 

Now, I'm using the onDeath event to find out the entity and see if it was killed by the player.

This snippet of code works in singleplayer but whenever I go on a server getSourceOfDamage() always returns null.

Is it perhaps that I can't get the people who died on a multiplayer server?

 

   

 @SubscribeEvent
    public void onDeath(LivingDeathEvent event) {
        attacker = event.source.getSourceOfDamage();
        if (attacker != null) {
            if (attacker.getEntityId() == mc.thePlayer.getEntityId()) {
                mc.thePlayer.sendChatMessage(event.entity.getCommandSenderName() + " ez");
            }
        }
    }

(Attacker is defined as an entity).

Thank you!

Link to comment
Share on other sites

  • Guest locked this topic
Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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