Converting entity tracking to use Bukkit metadata. Should greatly reduce lag on chunk loading and unloading.

This commit is contained in:
Glitchfinder
2013-02-18 16:13:33 -08:00
parent 45fbb47ccf
commit 519485f155
12 changed files with 22 additions and 394 deletions

View File

@ -67,7 +67,7 @@ public class CallOfTheWildEventHandler {
return;
LivingEntity entity = (LivingEntity) player.getWorld().spawnEntity(player.getLocation(), type);
mcMMO.placeStore.addSpawnedPet(entity);
entity.setMetadata(mcMMO.entityMetadataKey, mcMMO.entityMetadata);
((Tameable) entity).setOwner(player);

View File

@ -27,7 +27,10 @@ public class TamingManager extends SkillManager {
* @param event The event to award XP for
*/
public void awardTamingXP(EntityTameEvent event) {
if (mcMMO.placeStore.isSpawnedMob(event.getEntity())) {
if (event.getEntity() == null) {
return;
}
else if (event.getEntity().hasMetadata(mcMMO.entityMetadataKey)) {
return;
}