@@ -1,5 +1,5 @@
|
||||
--- ../work/decompile-8eb82bde//net/minecraft/server/EntityInsentient.java Sat Dec 6 21:48:11 2014
|
||||
+++ src/main/java/net/minecraft/server/EntityInsentient.java Sat Dec 6 21:18:38 2014
|
||||
--- /home/matt/mc-dev-private//net/minecraft/server/EntityInsentient.java 2015-02-26 22:40:22.575608140 +0000
|
||||
+++ src/main/java/net/minecraft/server/EntityInsentient.java 2015-02-26 22:40:22.579608139 +0000
|
||||
@@ -4,6 +4,15 @@
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
@@ -16,36 +16,44 @@
|
||||
public abstract class EntityInsentient extends EntityLiving {
|
||||
|
||||
public int a_;
|
||||
@@ -13,8 +22,8 @@
|
||||
@@ -13,14 +22,14 @@
|
||||
protected ControllerJump g;
|
||||
private EntityAIBodyControl b;
|
||||
protected NavigationAbstract navigation;
|
||||
- protected final PathfinderGoalSelector goalSelector;
|
||||
- protected final PathfinderGoalSelector targetSelector;
|
||||
+ public PathfinderGoalSelector goalSelector; // PAIL protected final to public
|
||||
+ public PathfinderGoalSelector targetSelector; // PAIL protected final to public
|
||||
+ public PathfinderGoalSelector goalSelector; // CraftBukkit - public
|
||||
+ public PathfinderGoalSelector targetSelector; // CraftBukkit - public
|
||||
private EntityLiving goalTarget;
|
||||
private EntitySenses bi;
|
||||
private EntitySenses bk;
|
||||
private ItemStack[] equipment = new ItemStack[5];
|
||||
@@ -39,7 +48,9 @@
|
||||
for (int i = 0; i < this.dropChances.length; ++i) {
|
||||
- protected float[] dropChances = new float[5];
|
||||
- private boolean canPickUpLoot;
|
||||
- private boolean persistent;
|
||||
+ public float[] dropChances = new float[5]; // CraftBukkit - public
|
||||
+ public boolean canPickUpLoot; // CraftBukkit - public
|
||||
+ public boolean persistent; // CraftBukkit - public
|
||||
private boolean bo;
|
||||
private Entity bp;
|
||||
private NBTTagCompound bq;
|
||||
@@ -40,6 +49,9 @@
|
||||
this.dropChances[i] = 0.085F;
|
||||
}
|
||||
-
|
||||
|
||||
+ // CraftBukkit start - default persistance to type's persistance value
|
||||
+ this.persistent = !isTypeNotPersistent();
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
protected void aW() {
|
||||
@@ -76,7 +87,37 @@
|
||||
protected void initAttributes() {
|
||||
@@ -76,7 +88,37 @@
|
||||
}
|
||||
|
||||
public void setGoalTarget(EntityLiving entityliving) {
|
||||
+ // CraftBukkit start - fire event
|
||||
+ setGoalTarget(entityliving, EntityTargetEvent.TargetReason.UNKNOWN, true);
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ public void setGoalTarget(EntityLiving entityliving, EntityTargetEvent.TargetReason reason, boolean fireEvent) {
|
||||
+ if (getGoalTarget() == entityliving) return;
|
||||
+ if (fireEvent) {
|
||||
@@ -64,7 +72,7 @@
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ if (event.getTarget() != null) {
|
||||
+ entityliving = ((CraftLivingEntity) event.getTarget()).getHandle();
|
||||
+ } else {
|
||||
@@ -75,12 +83,12 @@
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public boolean a(Class oclass) {
|
||||
@@ -235,11 +276,21 @@
|
||||
public boolean a(Class<? extends EntityLiving> oclass) {
|
||||
@@ -235,11 +277,20 @@
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
super.a(nbttagcompound);
|
||||
+
|
||||
+
|
||||
+ // CraftBukkit start - If looting or persistence is false only use it if it was set after we started using it
|
||||
if (nbttagcompound.hasKeyOfType("CanPickUpLoot", 1)) {
|
||||
- this.j(nbttagcompound.getBoolean("CanPickUpLoot"));
|
||||
@@ -96,7 +104,6 @@
|
||||
+ this.persistent = data;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
NBTTagList nbttaglist;
|
||||
int i;
|
||||
|
||||
@@ -109,15 +116,15 @@
|
||||
this.die();
|
||||
}
|
||||
|
||||
- if (this.aO > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D && this.isTypeNotPersistent()) {
|
||||
+ if (this.aO > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D) { // CraftBukkit - remove isTypeNotPersistent() check
|
||||
- if (this.ticksFarFromPlayer > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D && this.isTypeNotPersistent()) {
|
||||
+ if (this.ticksFarFromPlayer > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D) { // CraftBukkit - remove isTypeNotPersistent() check
|
||||
this.die();
|
||||
} else if (d3 < 1024.0D) {
|
||||
this.aO = 0;
|
||||
this.ticksFarFromPlayer = 0;
|
||||
@@ -707,6 +758,12 @@
|
||||
|
||||
public final boolean e(EntityHuman entityhuman) {
|
||||
if (this.cb() && this.getLeashHolder() == entityhuman) {
|
||||
if (this.cc() && this.getLeashHolder() == entityhuman) {
|
||||
+ // CraftBukkit start - fire PlayerUnleashEntityEvent
|
||||
+ if (CraftEventFactory.callPlayerUnleashEntityEvent(this, entityhuman).isCancelled()) {
|
||||
+ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutAttachEntity(1, this, this.getLeashHolder()));
|
||||
@@ -129,7 +136,7 @@
|
||||
} else {
|
||||
@@ -714,12 +771,24 @@
|
||||
|
||||
if (itemstack != null && itemstack.getItem() == Items.LEAD && this.ca()) {
|
||||
if (itemstack != null && itemstack.getItem() == Items.LEAD && this.cb()) {
|
||||
if (!(this instanceof EntityTameableAnimal) || !((EntityTameableAnimal) this).isTamed()) {
|
||||
+ // CraftBukkit start - fire PlayerLeashEntityEvent
|
||||
+ if (CraftEventFactory.callPlayerLeashEntityEvent(this, entityhuman, entityhuman).isCancelled()) {
|
||||
@@ -154,22 +161,22 @@
|
||||
return true;
|
||||
@@ -741,10 +810,12 @@
|
||||
|
||||
if (this.bm) {
|
||||
if (this.bo) {
|
||||
if (!this.isAlive()) {
|
||||
+ this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.PLAYER_UNLEASH)); // CraftBukkit
|
||||
this.unleash(true, true);
|
||||
}
|
||||
|
||||
if (this.bn == null || this.bn.dead) {
|
||||
if (this.bp == null || this.bp.dead) {
|
||||
+ this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.HOLDER_GONE)); // CraftBukkit
|
||||
this.unleash(true, true);
|
||||
}
|
||||
}
|
||||
@@ -811,6 +882,7 @@
|
||||
|
||||
this.bn = entityleash;
|
||||
this.bp = entityleash;
|
||||
} else {
|
||||
+ this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
|
||||
this.unleash(false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user