mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-14 01:04:24 +00:00
Re-added the patch for LivingExperienceDropEvent and enable it for dragons (#8388)
This commit is contained in:
1 parent
f19f7e4670
commit
82a20911cb
3 files changed
+51
-3
No files matched your search
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016-2021.
|
||||
* Copyright (c) 2016-2022.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -23,6 +23,8 @@ import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Event for when an entity drops experience on its death, can be used to change
|
||||
* the amount of experience points dropped or completely prevent dropping of experience
|
||||
@@ -31,12 +33,12 @@ import net.minecraftforge.eventbus.api.Cancelable;
|
||||
@Cancelable
|
||||
public class LivingExperienceDropEvent extends LivingEvent
|
||||
{
|
||||
private final Player attackingPlayer;
|
||||
@Nullable private final Player attackingPlayer;
|
||||
private final int originalExperiencePoints;
|
||||
|
||||
private int droppedExperiencePoints;
|
||||
|
||||
public LivingExperienceDropEvent(LivingEntity entity, Player attackingPlayer, int originalExperience)
|
||||
public LivingExperienceDropEvent(LivingEntity entity, @Nullable Player attackingPlayer, int originalExperience)
|
||||
{
|
||||
super(entity);
|
||||
|
||||
@@ -54,6 +56,10 @@ public class LivingExperienceDropEvent extends LivingEvent
|
||||
this.droppedExperiencePoints = droppedExperience;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The player that last attacked the entity and thus caused the experience. This can be null, in case the player has since logged out.
|
||||
*/
|
||||
@Nullable
|
||||
public Player getAttackingPlayer()
|
||||
{
|
||||
return attackingPlayer;
|
||||
|
||||
Reference in new issue
Block a user