/* * Returns true if the given npch already has an occupant. */ public static boolean hasOccupant(World worldIn, NPCHouse npch) { List<Entity> inHouse = new ArrayList(); List<Entity> allEntities = worldIn.loadedEntityList; for (Entity ent : allEntities) { if (BlockHelper.isInside(worldIn, ent.getPosition(), npch)) { inHouse.add(ent); } } for (Entity inside : inHouse) { if (inside instanceof EntityNPC) { EntityNPC temp = (EntityNPC) inside; if (npch.isEqual(temp.getNPCHouse())) { return true; } } } return false; }
public static String getChunkBiomeForEntity(Entity entity) { BlockPos pos = new BlockPos(entity.getPosition()); Chunk c = entity.worldObj.getChunkFromBlockCoords(pos); return c.getBiome(pos, entity.worldObj.getWorldChunkManager()).biomeName; }