use of com.microsoft.Malmo.Schemas.MobWithDescription in project malmo by Microsoft.
the class AgentQuitFromCatchingMobImplementation method doIWantToQuit.
@Override
public boolean doIWantToQuit(MissionInit missionInit) {
this.quitCode = "";
List<Entity> caughtEntities = RewardForCatchingMobImplementation.getCaughtEntities();
for (Entity ent : caughtEntities) {
// Do we care about this entity?
for (MobWithDescription mob : this.qcmparams.getMob()) {
for (EntityTypes et : mob.getType()) {
if (et.value().equals(ent.getName())) {
if (!mob.isGlobal()) {
// If global flag is false, our player needs to be adjacent to the mob in order to claim the reward.
BlockPos entityPos = new BlockPos(ent.posX, ent.posY, ent.posZ);
EntityPlayerSP player = Minecraft.getMinecraft().player;
BlockPos playerPos = new BlockPos(player.posX, player.posY, player.posZ);
if (Math.abs(entityPos.getX() - playerPos.getX()) + Math.abs(entityPos.getZ() - playerPos.getZ()) > 1)
continue;
}
this.quitCode = mob.getDescription();
return true;
}
}
}
}
return false;
}
Aggregations