本文整理汇总了Java中net.minecraft.server.MinecraftKey类的典型用法代码示例。如果您正苦于以下问题:Java MinecraftKey类的具体用法?Java MinecraftKey怎么用?Java MinecraftKey使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MinecraftKey类属于net.minecraft.server包,在下文中一共展示了MinecraftKey类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMaterialFromStatistic
import net.minecraft.server.MinecraftKey; //导入依赖的package包/类
public static Material getMaterialFromStatistic(net.minecraft.server.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;
}
}
示例2: tabCompleteInternalMaterialName
import net.minecraft.server.MinecraftKey; //导入依赖的package包/类
@Override
public List<String> tabCompleteInternalMaterialName(String token, List<String> completions) {
ArrayList<String> results = Lists.newArrayList();
for (MinecraftKey key : (Set<MinecraftKey>)Item.REGISTRY.keySet()) {
results.add(key.toString());
}
return StringUtil.copyPartialMatches(token, results, completions);
}
示例3: getKey
import net.minecraft.server.MinecraftKey; //导入依赖的package包/类
public static String getKey(Material material) {
MinecraftKey key = Item.REGISTRY.b(CraftMagicNumbers.getItem(material));
return key == null ? null : key.toString();
}
示例4: materialByKey
import net.minecraft.server.MinecraftKey; //导入依赖的package包/类
public static @Nullable Material materialByKey(String key) {
final Item item = Item.REGISTRY.get(new MinecraftKey(key));
return item == null ? null : CraftMagicNumbers.getMaterial(item);
}
示例5: getMaterialFromInternalName
import net.minecraft.server.MinecraftKey; //导入依赖的package包/类
@Override
public Material getMaterialFromInternalName(String name) {
return getMaterial((Item) Item.REGISTRY.get(new MinecraftKey(name)));
}
示例6: testReverse
import net.minecraft.server.MinecraftKey; //导入依赖的package包/类
@Test
public void testReverse() {
for (MinecraftKey effect : SoundEffect.a.keySet()) {
assertNotNull(effect + "", Sound.valueOf(effect.a().replace('.', '_').toUpperCase()));
}
}