(IRandomEntity randomEntity)
| 251 | } |
| 252 | |
| 253 | public boolean matches(IRandomEntity randomEntity) |
| 254 | { |
| 255 | if (this.biomes != null && !Matches.biome(randomEntity.getSpawnBiome(), this.biomes)) |
| 256 | { |
| 257 | return false; |
| 258 | } |
| 259 | else |
| 260 | { |
| 261 | if (this.heights != null) |
| 262 | { |
| 263 | BlockPos blockpos = randomEntity.getSpawnPosition(); |
| 264 | |
| 265 | if (blockpos != null && !this.heights.isInRange(blockpos.getY())) |
| 266 | { |
| 267 | return false; |
| 268 | } |
| 269 | } |
| 270 | |
| 271 | if (this.healthRange != null) |
| 272 | { |
| 273 | int i1 = randomEntity.getHealth(); |
| 274 | |
| 275 | if (this.healthPercent) |
| 276 | { |
| 277 | int i = randomEntity.getMaxHealth(); |
| 278 | |
| 279 | if (i > 0) |
| 280 | { |
| 281 | i1 = (int)((double)(i1 * 100) / (double)i); |
| 282 | } |
| 283 | } |
| 284 | |
| 285 | if (!this.healthRange.isInRange(i1)) |
| 286 | { |
| 287 | return false; |
| 288 | } |
| 289 | } |
| 290 | |
| 291 | if (this.nbtName != null) |
| 292 | { |
| 293 | String s = randomEntity.getName(); |
| 294 | |
| 295 | if (!this.nbtName.matchesValue(s)) |
| 296 | { |
| 297 | return false; |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | if (this.professions != null && randomEntity instanceof RandomEntity) |
| 302 | { |
| 303 | RandomEntity randomentity = (RandomEntity)randomEntity; |
| 304 | Entity entity = randomentity.getEntity(); |
| 305 | |
| 306 | if (entity instanceof EntityVillager) |
| 307 | { |
| 308 | EntityVillager entityvillager = (EntityVillager)entity; |
| 309 | int j = entityvillager.getProfession(); |
| 310 | int k = Reflector.getFieldValueInt(entityvillager, Reflector.EntityVillager_careerId, -1); |
no test coverage detected