Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-21 05:50:05 +01:00
58 Zeilen
2.4 KiB
Diff
58 Zeilen
2.4 KiB
Diff
--- a/net/minecraft/server/EntityEnderman.java
|
|
+++ b/net/minecraft/server/EntityEnderman.java
|
|
@@ -51,7 +51,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
|
|
AttributeModifiable attributemodifiable = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
|
|
|
|
if (entityliving == null) {
|
|
@@ -66,6 +76,7 @@
|
|
attributemodifiable.b(EntityEnderman.c);
|
|
}
|
|
}
|
|
+ return true;
|
|
|
|
}
|
|
|
|
@@ -359,8 +370,12 @@
|
|
boolean flag = movingobjectpositionblock.getBlockPosition().equals(blockposition);
|
|
|
|
if (block.a((Tag) TagsBlock.ENDERMAN_HOLDABLE) && flag) {
|
|
- world.a(blockposition, false);
|
|
- this.enderman.setCarried(iblockdata.getBlock().getBlockData());
|
|
+ // CraftBukkit start - Pickup event
|
|
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, Blocks.AIR.getBlockData()).isCancelled()) {
|
|
+ world.a(blockposition, false);
|
|
+ this.enderman.setCarried(iblockdata.getBlock().getBlockData());
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
}
|
|
@@ -395,8 +410,12 @@
|
|
if (iblockdata2 != null) {
|
|
iblockdata2 = Block.b(iblockdata2, (GeneratorAccess) this.a.world, blockposition);
|
|
if (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
|
|
}
|
|
|
|
}
|