Archiviert
13
0
Dieses Repository wurde am 2024-12-25 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
Paper-Old/nms-patches/EntityEnderman.patch

74 Zeilen
3.1 KiB
Diff

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/EntityEnderman.java
+++ b/net/minecraft/server/EntityEnderman.java
2018-07-15 02:00:00 +02:00
@@ -33,7 +33,14 @@
this.goalSelector.a(11, new EntityEnderman.PathfinderGoalEndermanPickupBlock(this));
this.targetSelector.a(1, new EntityEnderman.PathfinderGoalPlayerWhoLookedAtTarget(this));
this.targetSelector.a(2, new PathfinderGoalHurtByTarget(this, false, new Class[0]));
- this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget(this, EntityEndermite.class, 10, true, false, EntityEndermite::l));
+ // CraftBukkit - decompile error
+ this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget(this, EntityEndermite.class, 10, true, false, new Predicate<EntityEndermite>() {
+ @Override
+ public boolean test(EntityEndermite entityendermite) {
+ return entityendermite.l();
+ }
+ }));
+ // CraftBukkit end
}
protected void initAttributes() {
@@ -45,7 +52,17 @@
}
2016-05-10 13:47:39 +02:00
public void setGoalTarget(@Nullable EntityLiving entityliving) {
- 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);
+ }
+
+ @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
AttributeInstance attributeinstance = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED);
if (entityliving == null) {
2018-07-15 02:00:00 +02:00
@@ -59,6 +76,7 @@
attributeinstance.b(EntityEnderman.b);
}
}
+ return true;
}
2018-07-15 02:00:00 +02:00
@@ -277,8 +295,12 @@
2016-02-29 22:32:46 +01:00
boolean flag = movingobjectposition != null && movingobjectposition.a().equals(blockposition);
2018-08-26 04:00:00 +02:00
if (block.a(TagsBlock.ENDERMAN_HOLDABLE) && flag) {
2015-02-26 23:41:06 +01:00
- this.enderman.setCarried(iblockdata);
2016-02-29 22:32:46 +01:00
- world.setAir(blockposition);
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);
2016-02-29 22:32:46 +01:00
+ world.setAir(blockposition);
2015-02-26 23:41:06 +01:00
+ }
+ // CraftBukkit end
}
}
2018-07-15 02:00:00 +02:00
@@ -308,8 +330,12 @@
2016-02-29 22:32:46 +01:00
IBlockData iblockdata2 = this.a.getCarried();
2015-02-26 23:41:06 +01:00
2018-07-15 02:00:00 +02:00
if (iblockdata2 != null && this.a(world, blockposition, iblockdata2, iblockdata, iblockdata1)) {
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
}
}