/
CompatibilityUtils.java
50 lines (44 loc) · 1.29 KB
/
CompatibilityUtils.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package com.minecolonies.api.util;
import com.minecolonies.api.entity.citizen.AbstractEntityCitizen;
import net.minecraft.entity.Entity;
import net.minecraft.world.World;
/**
* This class group method use to insure compatibility between minecraft version.
* <p>
* This is the 1.15 version
*/
public final class CompatibilityUtils
{
private CompatibilityUtils()
{
//hide the constructor
}
/**
* get the world from the entity.
* <p>
* This method is aiming to hide the difference between 1.10.2 and 1.11.2
*
* @param entity to which we get the wolrd from
* @return the world
*/
public static World getWorldFromEntity(final Entity entity)
{
return entity.world;
}
public static World getWorldFromCitizen(final AbstractEntityCitizen baseEntityCitizen)
{
return getWorldFromEntity(baseEntityCitizen);
}
/**
* spawn an entity in the world
* <p>
* This method is aiming to hide the differnece between 1.10.2 and 1.11.2
*
* @param world The world which we are spawning the entity in.
* @param entityToSpawn The entity which we are spawning.
*/
public static void addEntity(final World world, final Entity entityToSpawn)
{
world.addEntity(entityToSpawn);
}
}