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());
}
}
}
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;
}
}
Aggregations