Search in sources :

Example 1 with MinecraftKey

use of net.minecraft.server.v1_12_R1.MinecraftKey in project Citizens2 by CitizensDev.

the class NMSImpl method registerEntityClass.

@Override
public void registerEntityClass(Class<?> clazz) {
    if (ENTITY_REGISTRY == null)
        return;
    Class<?> search = clazz;
    while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) {
        MinecraftKey key = ENTITY_REGISTRY.b(search);
        if (key == null)
            continue;
        int code = ENTITY_REGISTRY.a(search);
        ENTITY_REGISTRY.put(code, key, (Class<? extends Entity>) clazz);
        return;
    }
    throw new IllegalArgumentException("unable to find valid entity superclass for class " + clazz.toString());
}
Also used : PathEntity(net.minecraft.server.v1_11_R1.PathEntity) LivingEntity(org.bukkit.entity.LivingEntity) CraftEntity(org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity) SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity) Entity(net.minecraft.server.v1_11_R1.Entity) MinecraftKey(net.minecraft.server.v1_11_R1.MinecraftKey) PathPoint(net.minecraft.server.v1_11_R1.PathPoint)

Example 2 with MinecraftKey

use of net.minecraft.server.v1_12_R1.MinecraftKey in project Citizens2 by CitizensDev.

the class NMSImpl method registerEntityClass.

@Override
public void registerEntityClass(Class<?> clazz) {
    if (ENTITY_REGISTRY == null)
        return;
    Class<?> search = clazz;
    while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) {
        MinecraftKey key = ENTITY_REGISTRY.b(search);
        if (key == null)
            continue;
        int code = ENTITY_REGISTRY.a(search);
        ENTITY_REGISTRY.put(code, key, (Class<? extends Entity>) clazz);
        return;
    }
    throw new IllegalArgumentException("unable to find valid entity superclass for class " + clazz.toString());
}
Also used : PathEntity(net.minecraft.server.v1_12_R1.PathEntity) LivingEntity(org.bukkit.entity.LivingEntity) SkinnableEntity(net.citizensnpcs.npc.skin.SkinnableEntity) CraftEntity(org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity) Entity(net.minecraft.server.v1_12_R1.Entity) MinecraftKey(net.minecraft.server.v1_12_R1.MinecraftKey) PathPoint(net.minecraft.server.v1_12_R1.PathPoint)

Aggregations

SkinnableEntity (net.citizensnpcs.npc.skin.SkinnableEntity)2 LivingEntity (org.bukkit.entity.LivingEntity)2 Entity (net.minecraft.server.v1_11_R1.Entity)1 MinecraftKey (net.minecraft.server.v1_11_R1.MinecraftKey)1 PathEntity (net.minecraft.server.v1_11_R1.PathEntity)1 PathPoint (net.minecraft.server.v1_11_R1.PathPoint)1 Entity (net.minecraft.server.v1_12_R1.Entity)1 MinecraftKey (net.minecraft.server.v1_12_R1.MinecraftKey)1 PathEntity (net.minecraft.server.v1_12_R1.PathEntity)1 PathPoint (net.minecraft.server.v1_12_R1.PathPoint)1 CraftEntity (org.bukkit.craftbukkit.v1_11_R1.entity.CraftEntity)1 CraftEntity (org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity)1