Java Code Examples for net.minecraft.item.Item.getRegistryName()

The following are Jave code examples for showing how to use getRegistryName() of the net.minecraft.item.Item class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Bewitchment   File: ModelHandler.java   Source Code and License Vote up 5 votes
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);
	}
}
 
Example 2
Project: harshencastle   File: ItemsEnabled.java   Source Code and License Vote up 5 votes
@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);
}
 
Example 3
Project: Solar   File: ModelHandler.java   Source Code and License Vote up 5 votes
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);
	}
}
 
Example 4
Project: CustomWorldGen   File: GameRegistry.java   Source Code and License Vote up 5 votes
/**
 * 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);
}
 
Example 5
Project: CustomWorldGen   File: ItemColors.java   Source Code and License Vote up 5 votes
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);
    }
}
 
Example 6
Project: Bewitchment   File: ModelHandler.java   Source Code and License Vote up 4 votes
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);
}
 
Example 7
Project: Bewitchment   File: ModelHandler.java   Source Code and License Vote up 4 votes
public static void registerForgeModel(Item item, int meta, String variant) {
	ModelResourceLocation modelResourceLocation = new ModelResourceLocation(item.getRegistryName(), variant);
	ModelLoader.setCustomModelResourceLocation(item, meta, modelResourceLocation);
}
 
Example 8
Project: Bewitchment   File: ModelHandler.java   Source Code and License Vote up 4 votes
public static void registerModel(Item item, int meta) {
	ModelResourceLocation modelResourceLocation = new ModelResourceLocation(item.getRegistryName(), "inventory");
	ModelLoader.setCustomModelResourceLocation(item, meta, modelResourceLocation);
}
 
Example 9
Project: Solar   File: ModelHandler.java   Source Code and License Vote up 4 votes
public static void registerModel(Item item, int meta, String variant) {
	ModelResourceLocation location = new ModelResourceLocation(item.getRegistryName(), variant);
	ModelLoader.setCustomModelResourceLocation(item, meta, location);
}
 
Example 10
Project: Solar   File: ModelHandler.java   Source Code and License Vote up 4 votes
public static void registerModel(Item item, int meta) {
	ModelResourceLocation location = new ModelResourceLocation(item.getRegistryName(), "inventory");
	ModelLoader.setCustomModelResourceLocation(item, meta, location);
}
 
Example 11
Project: Solar   File: DummyBakedRegistry.java   Source Code and License Vote up 4 votes
public static void register(Item item, BiFunction<VertexFormat, Function<ResourceLocation, TextureAtlasSprite>, IBakedModel> function) {
	ResourceLocation location = item.getRegistryName();
	BAKERS.putIfAbsent(location, function);
}
 
Example 12
Project: TechReborn3   File: TechRebornClient.java   Source Code and License Vote up 4 votes
static void registerItemModel(Item i, int meta) {
	ResourceLocation loc = i.getRegistryName();
	ModelLoader.setCustomModelResourceLocation(i, meta, new ModelResourceLocation(loc, "inventory"));
}
 
Example 13
Project: TechReborn3   File: TechRebornClient.java   Source Code and License Vote up 4 votes
static void registerItemModel(Item i, int meta, String variant, String property) {
	ResourceLocation loc = i.getRegistryName();
	ModelLoader.setCustomModelResourceLocation(i, meta, new ModelResourceLocation(loc, property + "=" + variant));
}
 
Example 14
Project: EasyCraft   File: ItemLoader.java   Source Code and License Vote up 4 votes
@SideOnly(Side.CLIENT)
private static void registerRender(Item item){
	ModelResourceLocation model=new ModelResourceLocation(item.getRegistryName(),"inventory");
	ModelLoader.setCustomModelResourceLocation(item, 0, model);
}