Store interacting mob instead of disposing of.

This commit is contained in:
Major-
2014-02-21 01:05:04 +00:00
parent 57e9e9eabe
commit 55245c47f2
+17 -2
View File
@@ -57,6 +57,11 @@ public abstract class Mob extends Entity {
*/ */
protected int index = -1; protected int index = -1;
/**
* The mob this mob is interacting with.
*/
protected Mob interactingMob;
/** /**
* This mob's inventory. * This mob's inventory.
*/ */
@@ -419,8 +424,18 @@ public abstract class Mob extends Entity {
* *
* @param index The index of the interacting mob. * @param index The index of the interacting mob.
*/ */
public void updateInteractingMob(int index) { public void updateInteractingMob(final Mob mob) {
blockSet.add(SynchronizationBlock.createInteractingMobBlock(index)); blockSet.add(SynchronizationBlock.createInteractingMobBlock(mob.index));
this.interactingMob = mob;
}
/**
* Gets the mob this mob is interacting with.
*
* @return The mob.
*/
public Mob getInteractingMob() {
return interactingMob;
} }
} }