MCPcopy Create free account
hub / github.com/DGVPSH/SlackOpen / matches

Method matches

src/main/java/net/optifine/RandomEntityRule.java:253–423  ·  view source on GitHub ↗
(IRandomEntity randomEntity)

Source from the content-addressed store, hash-verified

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);

Callers 1

getTextureLocationMethod · 0.95

Calls 15

biomeMethod · 0.95
getEntityMethod · 0.95
getProfessionMethod · 0.95
getFieldValueIntMethod · 0.95
matchesMethod · 0.95
getCollarColorMethod · 0.95
equalsOneMethod · 0.95
getMinecraftMethod · 0.95
getMoonPhaseMethod · 0.95
getWorldInfoMethod · 0.95
getWeatherMethod · 0.95
containsMethod · 0.95

Tested by

no test coverage detected