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

Class RandomEntity

src/main/java/net/optifine/RandomEntity.java:9–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7import net.minecraft.world.biome.BiomeGenBase;
8
9public class RandomEntity implements IRandomEntity
10{
11 private Entity entity;
12
13 public int getId()
14 {
15 UUID uuid = this.entity.getUniqueID();
16 long i = uuid.getLeastSignificantBits();
17 int j = (int)(i & 2147483647L);
18 return j;
19 }
20
21 public BlockPos getSpawnPosition()
22 {
23 return this.entity.getDataWatcher().spawnPosition;
24 }
25
26 public BiomeGenBase getSpawnBiome()
27 {
28 return this.entity.getDataWatcher().spawnBiome;
29 }
30
31 public String getName()
32 {
33 return this.entity.hasCustomName() ? this.entity.getCustomNameTag() : null;
34 }
35
36 public int getHealth()
37 {
38 if (!(this.entity instanceof EntityLiving))
39 {
40 return 0;
41 }
42 else
43 {
44 EntityLiving entityliving = (EntityLiving)this.entity;
45 return (int)entityliving.getHealth();
46 }
47 }
48
49 public int getMaxHealth()
50 {
51 if (!(this.entity instanceof EntityLiving))
52 {
53 return 0;
54 }
55 else
56 {
57 EntityLiving entityliving = (EntityLiving)this.entity;
58 return (int)entityliving.getMaxHealth();
59 }
60 }
61
62 public Entity getEntity()
63 {
64 return this.entity;
65 }
66

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected