本文整理汇总了Java中net.minecraft.item.Item.getRegistryName方法的典型用法代码示例。如果您正苦于以下问题:Java Item.getRegistryName方法的具体用法?Java Item.getRegistryName怎么用?Java Item.getRegistryName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.item.Item
的用法示例。
在下文中一共展示了Item.getRegistryName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerModel
import net.minecraft.item.Item; //导入方法依赖的package包/类
public static <T extends Enum<T> & IStringSerializable> void registerModel(Item item, Class<T> clazz) {
for (T t : clazz.getEnumConstants()) {
ResourceLocation location = new ResourceLocation(item.getRegistryName() + "_" + t.getName());
ModelResourceLocation modelResourceLocation = new ModelResourceLocation(location, "inventory");
ModelLoader.setCustomModelResourceLocation(item, t.ordinal(), modelResourceLocation);
}
}
示例2: testIfLegit
import net.minecraft.item.Item; //导入方法依赖的package包/类
@Override
protected boolean testIfLegit(Item componant) {
boolean legit = componant.getRegistryName() != null;
if(!legit)
new NullPointerException("Tried to config a Item with no registry name. Item: " + componant.getClass());
return super.testIfLegit(componant);
}
示例3: registerModel
import net.minecraft.item.Item; //导入方法依赖的package包/类
public static <T extends Enum<T> & IStringSerializable> void registerModel(Item item, Class<T> clazz) {
for(T t : clazz.getEnumConstants()) {
ResourceLocation location = new ResourceLocation(item.getRegistryName() + "_" + t.getName());
ModelResourceLocation modelResourceLocation = new ModelResourceLocation(location, "inventory");
ModelLoader.setCustomModelResourceLocation(item, t.ordinal(), modelResourceLocation);
}
}
示例4: registerItem
import net.minecraft.item.Item; //导入方法依赖的package包/类
/**
* Use {@link #register(IForgeRegistryEntry)} instead
*/
@Deprecated
public static void registerItem(Item item, String name)
{
if (item.getRegistryName() == null && Strings.isNullOrEmpty(name))
throw new IllegalArgumentException("Attempted to register a item with no name: " + item);
if (item.getRegistryName() != null && !item.getRegistryName().toString().equals(name))
throw new IllegalArgumentException("Attempted to register a item with conflicting names. Old: " + item.getRegistryName() + " New: " + name);
register(item.getRegistryName() == null ? item.setRegistryName(name) : item);
}
示例5: registerItemColorHandler
import net.minecraft.item.Item; //导入方法依赖的package包/类
public void registerItemColorHandler(IItemColor itemColor, Item... itemsIn)
{
for (Item item : itemsIn)
{
if (item == null) throw new IllegalArgumentException("Item registered to item color handler cannot be null!");
if (item.getRegistryName() == null) throw new IllegalArgumentException("Item must be registered before assigning color handler.");
this.itemColorMap.put(item.delegate, itemColor);
}
}
示例6: registerForgeModel
import net.minecraft.item.Item; //导入方法依赖的package包/类
public static void registerForgeModel(Block block, int meta, String variant) {
Item item = Item.getItemFromBlock(block);
if (item == Items.AIR) throw new UnsupportedOperationException("This block has no Item!");
ModelResourceLocation modelResourceLocation = new ModelResourceLocation(item.getRegistryName(), variant);
ModelLoader.setCustomModelResourceLocation(item, meta, modelResourceLocation);
}
示例7: register
import net.minecraft.item.Item; //导入方法依赖的package包/类
public static void register(Item item, BiFunction<VertexFormat, Function<ResourceLocation, TextureAtlasSprite>, IBakedModel> function) {
ResourceLocation location = item.getRegistryName();
BAKERS.putIfAbsent(location, function);
}
示例8: registerItemModel
import net.minecraft.item.Item; //导入方法依赖的package包/类
static void registerItemModel(Item i, int meta) {
ResourceLocation loc = i.getRegistryName();
ModelLoader.setCustomModelResourceLocation(i, meta, new ModelResourceLocation(loc, "inventory"));
}
示例9: registerRender
import net.minecraft.item.Item; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
private static void registerRender(Item item){
ModelResourceLocation model=new ModelResourceLocation(item.getRegistryName(),"inventory");
ModelLoader.setCustomModelResourceLocation(item, 0, model);
}