aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/og/net/minecraft/world/entity/monster/EntityEnderman.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/og/net/minecraft/world/entity/monster/EntityEnderman.patch')
-rw-r--r--patch-remap/og/net/minecraft/world/entity/monster/EntityEnderman.patch65
1 files changed, 65 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/world/entity/monster/EntityEnderman.patch b/patch-remap/og/net/minecraft/world/entity/monster/EntityEnderman.patch
new file mode 100644
index 0000000000..0470b2434f
--- /dev/null
+++ b/patch-remap/og/net/minecraft/world/entity/monster/EntityEnderman.patch
@@ -0,0 +1,65 @@
+--- a/net/minecraft/world/entity/monster/EntityEnderman.java
++++ b/net/minecraft/world/entity/monster/EntityEnderman.java
+@@ -71,6 +71,11 @@
+ import net.minecraft.world.phys.Vec3D;
+ import org.joml.Vector3f;
+
++// 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 UUID SPEED_MODIFIER_ATTACKING_UUID = UUID.fromString("020E0DFB-87AE-4653-9556-831010E291A0");
+@@ -115,7 +120,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) {
+@@ -130,6 +145,7 @@
+ attributemodifiable.addTransientModifier(EntityEnderman.SPEED_MODIFIER_ATTACKING);
+ }
+ }
++ return true;
+
+ }
+
+@@ -493,9 +509,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(GameEvent.BLOCK_PLACE, blockposition, GameEvent.a.of(this.enderman, iblockdata2));
+ this.enderman.setCarriedBlock((IBlockData) null);
++ } // CraftBukkit
+ }
+
+ }
+@@ -534,9 +552,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(GameEvent.BLOCK_DESTROY, blockposition, GameEvent.a.of(this.enderman, iblockdata));
+ this.enderman.setCarriedBlock(iblockdata.getBlock().defaultBlockState());
++ } // CraftBukkit
+ }
+
+ }