Search in sources :

Example 6 with MinecraftKey

use of net.minecraft.server.v1_16_R3.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 7 with MinecraftKey

use of net.minecraft.server.v1_16_R3.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

ItemStack (org.bukkit.inventory.ItemStack)3 SkinnableEntity (net.citizensnpcs.npc.skin.SkinnableEntity)2 LivingEntity (org.bukkit.entity.LivingEntity)2 MyPetBaby (de.Keyle.MyPet.api.entity.MyPetBaby)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 DataOutputStream (java.io.DataOutputStream)1 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 MinecraftKey (net.minecraft.server.v1_15_R1.MinecraftKey)1 PacketDataSerializer (net.minecraft.server.v1_15_R1.PacketDataSerializer)1 PacketPlayOutCustomPayload (net.minecraft.server.v1_15_R1.PacketPlayOutCustomPayload)1 net.minecraft.server.v1_16_R3 (net.minecraft.server.v1_16_R3)1 EntitySize (net.minecraft.server.v1_16_R3.EntitySize)1 MinecraftKey (net.minecraft.server.v1_16_R3.MinecraftKey)1