2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/entity/monster/EntityEnderman.java
|
|
|
|
+++ b/net/minecraft/world/entity/monster/EntityEnderman.java
|
2021-11-21 23:00:00 +01:00
|
|
|
@@ -110,7 +110,17 @@
|
2016-04-20 12:40:16 +02:00
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
@Override
|
2021-11-21 23:00:00 +01:00
|
|
|
public void setTarget(@Nullable EntityLiving entityliving) {
|
|
|
|
- super.setTarget(entityliving);
|
2016-04-20 12:40:16 +02:00
|
|
|
+ // CraftBukkit start - fire event
|
2021-11-21 23:00:00 +01:00
|
|
|
+ setTarget(entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason.UNKNOWN, true);
|
2016-04-20 12:40:16 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
2021-11-21 23:00:00 +01:00
|
|
|
+ public boolean setTarget(EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) {
|
|
|
|
+ if (!super.setTarget(entityliving, reason, fireEvent)) {
|
2016-04-20 12:40:16 +02:00
|
|
|
+ return false;
|
|
|
|
+ }
|
2021-11-21 23:00:00 +01:00
|
|
|
+ entityliving = getTarget();
|
2016-04-20 12:40:16 +02:00
|
|
|
+ // CraftBukkit end
|
2021-11-21 23:00:00 +01:00
|
|
|
AttributeModifiable attributemodifiable = this.getAttribute(GenericAttributes.MOVEMENT_SPEED);
|
2016-04-20 12:40:16 +02:00
|
|
|
|
|
|
|
if (entityliving == null) {
|
2021-11-21 23:00:00 +01:00
|
|
|
@@ -125,6 +135,7 @@
|
|
|
|
attributemodifiable.addTransientModifier(EntityEnderman.SPEED_MODIFIER_ATTACKING);
|
2016-04-20 12:40:16 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
+ return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
@@ -471,9 +482,13 @@
|
2021-06-11 07:00:00 +02:00
|
|
|
if (iblockdata2 != null) {
|
2021-11-21 23:00:00 +01:00
|
|
|
iblockdata2 = Block.updateFromNeighbourShapes(iblockdata2, this.enderman.level, blockposition);
|
|
|
|
if (this.canPlaceBlock(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) {
|
2021-06-11 07:00:00 +02:00
|
|
|
+ // CraftBukkit start - Place event
|
|
|
|
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, iblockdata2).isCancelled()) {
|
2021-11-21 23:00:00 +01:00
|
|
|
world.setBlock(blockposition, iblockdata2, 3);
|
|
|
|
world.gameEvent(this.enderman, GameEvent.BLOCK_PLACE, blockposition);
|
|
|
|
this.enderman.setCarriedBlock((IBlockData) null);
|
2021-06-11 07:00:00 +02:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2021-11-21 23:00:00 +01:00
|
|
|
@@ -512,9 +527,13 @@
|
|
|
|
boolean flag = movingobjectpositionblock.getBlockPos().equals(blockposition);
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
if (iblockdata.is((Tag) TagsBlock.ENDERMAN_HOLDABLE) && flag) {
|
|
|
|
- world.removeBlock(blockposition, false);
|
|
|
|
- world.gameEvent(this.enderman, GameEvent.BLOCK_DESTROY, blockposition);
|
|
|
|
- this.enderman.setCarriedBlock(iblockdata.getBlock().defaultBlockState());
|
2015-02-26 23:41:06 +01:00
|
|
|
+ // CraftBukkit start - Pickup event
|
2021-11-21 23:00:00 +01:00
|
|
|
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) {
|
|
|
|
+ world.removeBlock(blockposition, false);
|
|
|
|
+ world.gameEvent(this.enderman, GameEvent.BLOCK_DESTROY, blockposition);
|
|
|
|
+ this.enderman.setCarriedBlock(iblockdata.getBlock().defaultBlockState());
|
2015-02-26 23:41:06 +01:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|