Hello,
maybe its a very simple question, but I havent used Forge long.
Iam coding a mod for a server.
But how can I get the player, which is killing the Enderman?
@SubscribeEvent
public void onKill(LivingDeathEvent event) {
if (event.entityLiving.getName().equalsIgnoreCase(Minecraft.getMinecraft().thePlayer.getName())) {
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Test1"));
Entity e = event.entity;
if (e instanceof EntityEnderman) {
i++;
Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("§7Enderman killed: §e§l" + i));
}
}
}
The player will get the message if an Enderman dies, but it doesn't matter who killed the enderman.
But the player should only get the message, if he kills an Enderman.
How can I do this?
I am using Forge 1.8.9-11.15.1.2318
Thanks.
(Sorry for my bad english)