2015-05-25 12:37:24 +02:00
|
|
|
--- a/net/minecraft/server/EntityEnderman.java
|
|
|
|
+++ b/net/minecraft/server/EntityEnderman.java
|
2019-12-10 23:00:00 +01:00
|
|
|
@@ -52,7 +52,17 @@
|
2016-04-20 12:40:16 +02:00
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
@Override
|
2016-05-10 13:47:39 +02:00
|
|
|
public void setGoalTarget(@Nullable EntityLiving entityliving) {
|
2016-04-20 12:40:16 +02:00
|
|
|
- super.setGoalTarget(entityliving);
|
|
|
|
+ // CraftBukkit start - fire event
|
2018-07-15 02:00:00 +02:00
|
|
|
+ setGoalTarget(entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason.UNKNOWN, true);
|
2016-04-20 12:40:16 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @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
|
2020-06-25 02:00:00 +02:00
|
|
|
AttributeModifiable attributemodifiable = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
|
2016-04-20 12:40:16 +02:00
|
|
|
|
|
|
|
if (entityliving == null) {
|
2019-12-10 23:00:00 +01:00
|
|
|
@@ -67,6 +77,7 @@
|
2020-06-25 02:00:00 +02:00
|
|
|
attributemodifiable.b(EntityEnderman.c);
|
2016-04-20 12:40:16 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
+ return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-06-25 02:00:00 +02:00
|
|
|
@@ -360,8 +371,12 @@
|
2019-12-10 23:00:00 +01:00
|
|
|
boolean flag = movingobjectpositionblock.getBlockPosition().equals(blockposition);
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2020-06-25 02:00:00 +02:00
|
|
|
if (block.a((Tag) TagsBlock.ENDERMAN_HOLDABLE) && flag) {
|
2015-02-26 23:41:06 +01:00
|
|
|
- this.enderman.setCarried(iblockdata);
|
2019-04-23 04:00:00 +02:00
|
|
|
- world.a(blockposition, false);
|
2015-02-26 23:41:06 +01:00
|
|
|
+ // CraftBukkit start - Pickup event
|
2018-07-15 02:00:00 +02:00
|
|
|
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
|
2015-02-26 23:41:06 +01:00
|
|
|
+ this.enderman.setCarried(iblockdata);
|
2019-04-23 04:00:00 +02:00
|
|
|
+ world.a(blockposition, false);
|
2015-02-26 23:41:06 +01:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2020-06-25 02:00:00 +02:00
|
|
|
@@ -394,8 +409,12 @@
|
2016-02-29 22:32:46 +01:00
|
|
|
IBlockData iblockdata2 = this.a.getCarried();
|
2015-02-26 23:41:06 +01:00
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
if (iblockdata2 != null && this.a(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) {
|
2015-02-26 23:41:06 +01:00
|
|
|
+ // CraftBukkit start - Place event
|
2018-07-15 02:00:00 +02:00
|
|
|
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.a, blockposition, iblockdata2).isCancelled()) {
|
2016-02-29 22:32:46 +01:00
|
|
|
world.setTypeAndData(blockposition, iblockdata2, 3);
|
|
|
|
this.a.setCarried((IBlockData) null);
|
2015-02-26 23:41:06 +01:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|