mirror of
https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git
synced 2024-11-25 08:06:14 +00:00
66 lines
2.9 KiB
Diff
66 lines
2.9 KiB
Diff
--- a/net/minecraft/world/entity/monster/EntityEnderman.java
|
|
+++ b/net/minecraft/world/entity/monster/EntityEnderman.java
|
|
@@ -70,6 +70,11 @@
|
|
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
|
import net.minecraft.world.phys.Vec3D;
|
|
|
|
+// CraftBukkit start;
|
|
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
|
+import org.bukkit.event.entity.EntityTargetEvent;
|
|
+// CraftBukkit end
|
|
+
|
|
public class EntityEnderman extends EntityMonster implements IEntityAngerable {
|
|
|
|
private static final MinecraftKey SPEED_MODIFIER_ATTACKING_ID = MinecraftKey.withDefaultNamespace("attacking");
|
|
@@ -113,7 +118,17 @@
|
|
|
|
@Override
|
|
public void setTarget(@Nullable EntityLiving entityliving) {
|
|
- super.setTarget(entityliving);
|
|
+ // CraftBukkit start - fire event
|
|
+ setTarget(entityliving, EntityTargetEvent.TargetReason.UNKNOWN, true);
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean setTarget(EntityLiving entityliving, EntityTargetEvent.TargetReason reason, boolean fireEvent) {
|
|
+ if (!super.setTarget(entityliving, reason, fireEvent)) {
|
|
+ return false;
|
|
+ }
|
|
+ entityliving = getTarget();
|
|
+ // CraftBukkit end
|
|
AttributeModifiable attributemodifiable = this.getAttribute(GenericAttributes.MOVEMENT_SPEED);
|
|
|
|
if (entityliving == null) {
|
|
@@ -128,6 +143,7 @@
|
|
attributemodifiable.addTransientModifier(EntityEnderman.SPEED_MODIFIER_ATTACKING);
|
|
}
|
|
}
|
|
+ return true;
|
|
|
|
}
|
|
|
|
@@ -466,9 +482,11 @@
|
|
if (iblockdata2 != null) {
|
|
iblockdata2 = Block.updateFromNeighbourShapes(iblockdata2, this.enderman.level(), blockposition);
|
|
if (this.canPlaceBlock(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) {
|
|
+ if (CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, iblockdata2)) { // CraftBukkit - Place event
|
|
world.setBlock(blockposition, iblockdata2, 3);
|
|
world.gameEvent((Holder) GameEvent.BLOCK_PLACE, blockposition, GameEvent.a.of(this.enderman, iblockdata2));
|
|
this.enderman.setCarriedBlock((IBlockData) null);
|
|
+ } // CraftBukkit
|
|
}
|
|
|
|
}
|
|
@@ -507,9 +525,11 @@
|
|
boolean flag = movingobjectpositionblock.getBlockPos().equals(blockposition);
|
|
|
|
if (iblockdata.is(TagsBlock.ENDERMAN_HOLDABLE) && flag) {
|
|
+ if (CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, Blocks.AIR.defaultBlockState())) { // CraftBukkit - Place event
|
|
world.removeBlock(blockposition, false);
|
|
world.gameEvent((Holder) GameEvent.BLOCK_DESTROY, blockposition, GameEvent.a.of(this.enderman, iblockdata));
|
|
this.enderman.setCarriedBlock(iblockdata.getBlock().defaultBlockState());
|
|
+ } // CraftBukkit
|
|
}
|
|
|
|
}
|