2015-05-25 18:37:24 +08:00
|
|
|
--- a/net/minecraft/server/EntityEnderman.java
|
|
|
|
+++ b/net/minecraft/server/EntityEnderman.java
|
2016-04-20 18:40:16 +08:00
|
|
|
@@ -4,6 +4,8 @@
|
|
|
|
import com.google.common.base.Optional;
|
|
|
|
import com.google.common.base.Predicate;
|
|
|
|
import com.google.common.collect.Sets;
|
|
|
|
+import org.bukkit.event.entity.EntityTargetEvent;
|
|
|
|
+
|
|
|
|
import java.util.Random;
|
|
|
|
import java.util.Set;
|
|
|
|
import java.util.UUID;
|
2016-05-10 19:47:39 +08:00
|
|
|
@@ -56,7 +58,17 @@
|
2016-04-20 18:40:16 +08:00
|
|
|
}
|
|
|
|
|
2016-05-10 19:47:39 +08:00
|
|
|
public void setGoalTarget(@Nullable EntityLiving entityliving) {
|
2016-04-20 18:40:16 +08:00
|
|
|
- super.setGoalTarget(entityliving);
|
|
|
|
+ // CraftBukkit start - fire event
|
|
|
|
+ setGoalTarget(entityliving, 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) {
|
2016-05-10 19:47:39 +08:00
|
|
|
@@ -70,6 +82,7 @@
|
2016-04-20 18:40:16 +08:00
|
|
|
attributeinstance.b(EntityEnderman.b);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
+ return true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2016-06-09 09:43:49 +08:00
|
|
|
@@ -320,8 +333,12 @@
|
2016-03-01 05:32:46 +08:00
|
|
|
boolean flag = movingobjectposition != null && movingobjectposition.a().equals(blockposition);
|
2014-11-26 05:32:16 +08:00
|
|
|
|
2016-03-01 05:32:46 +08:00
|
|
|
if (EntityEnderman.c.contains(block) && flag) {
|
2015-02-27 06:41:06 +08:00
|
|
|
- this.enderman.setCarried(iblockdata);
|
2016-03-01 05:32:46 +08:00
|
|
|
- world.setAir(blockposition);
|
2015-02-27 06:41:06 +08:00
|
|
|
+ // CraftBukkit start - Pickup event
|
|
|
|
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.enderman, this.enderman.world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), org.bukkit.Material.AIR).isCancelled()) {
|
|
|
|
+ this.enderman.setCarried(iblockdata);
|
2016-03-01 05:32:46 +08:00
|
|
|
+ world.setAir(blockposition);
|
2015-02-27 06:41:06 +08:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2016-06-09 09:43:49 +08:00
|
|
|
@@ -351,8 +368,12 @@
|
2016-03-01 05:32:46 +08:00
|
|
|
IBlockData iblockdata2 = this.a.getCarried();
|
2015-02-27 06:41:06 +08:00
|
|
|
|
2016-03-01 05:32:46 +08:00
|
|
|
if (iblockdata2 != null && this.a(world, blockposition, iblockdata2.getBlock(), iblockdata, iblockdata1)) {
|
2015-02-27 06:41:06 +08:00
|
|
|
+ // CraftBukkit start - Place event
|
|
|
|
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.a, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this.a.getCarried().getBlock(), this.a.getCarried().getBlock().toLegacyData(this.a.getCarried())).isCancelled()) {
|
2016-03-01 05:32:46 +08:00
|
|
|
world.setTypeAndData(blockposition, iblockdata2, 3);
|
|
|
|
this.a.setCarried((IBlockData) null);
|
2015-02-27 06:41:06 +08:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|