mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-23 01:17:44 +01:00
58 lines
2.3 KiB
Diff
58 lines
2.3 KiB
Diff
--- a/net/minecraft/server/EntityEnderman.java
|
|
+++ b/net/minecraft/server/EntityEnderman.java
|
|
@@ -52,7 +52,17 @@
|
|
|
|
@Override
|
|
public void setGoalTarget(@Nullable EntityLiving entityliving) {
|
|
- super.setGoalTarget(entityliving);
|
|
+ // CraftBukkit start - fire event
|
|
+ setGoalTarget(entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason.UNKNOWN, true);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean setGoalTarget(EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) {
|
|
+ if (!super.setGoalTarget(entityliving, reason, fireEvent)) {
|
|
+ return false;
|
|
+ }
|
|
+ entityliving = getGoalTarget();
|
|
+ // CraftBukkit end
|
|
AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
|
|
|
|
if (entityliving == null) {
|
|
@@ -67,6 +77,7 @@
|
|
attributeinstance.addModifier(EntityEnderman.c);
|
|
}
|
|
}
|
|
+ return true;
|
|
|
|
}
|
|
|
|
@@ -323,8 +334,12 @@
|
|
boolean flag = movingobjectpositionblock.getBlockPosition().equals(blockposition);
|
|
|
|
if (block.a(TagsBlock.ENDERMAN_HOLDABLE) && flag) {
|
|
- this.enderman.setCarried(iblockdata);
|
|
- world.a(blockposition, false);
|
|
+ // CraftBukkit start - Pickup event
|
|
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
|
|
+ this.enderman.setCarried(iblockdata);
|
|
+ world.a(blockposition, false);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
}
|
|
@@ -357,8 +372,12 @@
|
|
IBlockData iblockdata2 = this.a.getCarried();
|
|
|
|
if (iblockdata2 != null && this.a(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) {
|
|
+ // CraftBukkit start - Place event
|
|
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.a, blockposition, iblockdata2).isCancelled()) {
|
|
world.setTypeAndData(blockposition, iblockdata2, 3);
|
|
this.a.setCarried((IBlockData) null);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
}
|