Search in sources :

Example 46 with MinecraftKey

use of net.minecraft.server.v1_14_R1.MinecraftKey in project PaperDev by Kamillaova.

the class CraftMetaSpawnEgg method deserializeInternal.

@Override
void deserializeInternal(NBTTagCompound tag) {
    super.deserializeInternal(tag);
    if (tag.hasKey(ENTITY_TAG.NBT)) {
        entityTag = tag.getCompound(ENTITY_TAG.NBT);
        // PAIL: convert
        MinecraftServer.getServer().dataConverterManager.a(DataConverterTypes.ENTITY, entityTag);
        if (entityTag.hasKey(ENTITY_ID.NBT)) {
            this.spawnedType = EntityType.fromName(new MinecraftKey(entityTag.getString(ENTITY_ID.NBT)).getKey());
        }
    }
}
Also used : MinecraftKey(net.minecraft.server.v1_12_R1.MinecraftKey)

Example 47 with MinecraftKey

use of net.minecraft.server.v1_14_R1.MinecraftKey in project PaperDev by Kamillaova.

the class CraftStatistic method getMaterialFromStatistic.

public static Material getMaterialFromStatistic(net.minecraft.server.v1_12_R1.Statistic statistic) {
    String statisticString = statistic.name;
    String val = statisticString.substring(statisticString.lastIndexOf(".") + 1);
    Item item = (Item) Item.REGISTRY.get(new MinecraftKey(val));
    if (item != null) {
        return Material.getMaterial(Item.getId(item));
    }
    Block block = (Block) Block.REGISTRY.get(new MinecraftKey(val));
    if (block != null) {
        return Material.getMaterial(Block.getId(block));
    }
    try {
        return Material.getMaterial(Integer.parseInt(val));
    } catch (NumberFormatException e) {
        return null;
    }
}
Also used : Item(net.minecraft.server.v1_12_R1.Item) Block(net.minecraft.server.v1_12_R1.Block) MinecraftKey(net.minecraft.server.v1_12_R1.MinecraftKey)

Aggregations

MinecraftKey (net.minecraft.server.v1_16_R3.MinecraftKey)9 Field (java.lang.reflect.Field)8 SkinnableEntity (net.citizensnpcs.npc.skin.SkinnableEntity)6 MinecraftKey (net.minecraft.server.v1_12_R1.MinecraftKey)6 MinecraftKey (net.minecraft.server.v1_15_R1.MinecraftKey)6 MinecraftKey (net.minecraft.server.v1_16_R2.MinecraftKey)6 LivingEntity (org.bukkit.entity.LivingEntity)6 MinecraftKey (net.minecraft.server.v1_13_R2.MinecraftKey)5 MinecraftKey (net.minecraft.server.v1_14_R1.MinecraftKey)5 MinecraftKey (net.minecraft.server.v1_11_R1.MinecraftKey)4 MinecraftKey (net.minecraft.server.v1_16_R1.MinecraftKey)4 NamespacedKey (org.bukkit.NamespacedKey)3 EntityType (org.bukkit.entity.EntityType)3 MobSpawningMethod (dev.rosewood.rosestacker.spawner.spawning.MobSpawningMethod)2 SpawnerStackSettings (dev.rosewood.rosestacker.stack.settings.SpawnerStackSettings)2 List (java.util.List)2 Entity (net.minecraft.server.v1_11_R1.Entity)2 TileEntityMobSpawner (net.minecraft.server.v1_11_R1.TileEntityMobSpawner)2 Entity (net.minecraft.server.v1_12_R1.Entity)2 TileEntityMobSpawner (net.minecraft.server.v1_12_R1.TileEntityMobSpawner)2