Jump to content

Recommended Posts

Posted

Hey there. Currently I'm in the process of updating everything to 1.12, since I'm fairly sure that I'm never going to finish my mod while 1.10 is still relevant. And it's plainly easier to release everything for 1.12 and have longevity for a year or so.

 

Anyway.  I'm registering blocks and blockItems as such: 

 

    @SubscribeEvent
    public void registerBlocks(RegistryEvent.Register<Block> event){
        final Block[] blocks = {
                oreSilver,
                shrine,
        };

        event.getRegistry().registerAll(blocks);
    }

    @SubscribeEvent
    public void registerItemBlock(RegistryEvent.Register<Item> event){
        final ItemBlock[] items = {
             new ItemBlock(shrine),
             new ItemBlock(oreSilver),
        };
        for(final ItemBlock item:items){
            final Block block = item.getBlock();
            event.getRegistry().register(item.setRegistryName(block.getRegistryName()));
        }
    }

 

 

obviously I subscribe the event and such.

 

If I don't register an ItemBlock I don't get an item. Previously I was able to just get an item from the block, considering that blocks had an item that was just a miniature render of the block.

 

Now all of my itemBlocks give me a default/missing pink and black texture.

 

Is that because I need a JSON file and a texture for all my blocks? Is there a way to simply add a default texture to my items? The setCustomModelResourceLocation method still works, but I'm assuming there's perhaps a more up to date method?

 

 

 

Posted

You need to subscribe to the ModelRegistryEvent in order to register models for your items with ModelLoader.setCustomModelResourceLocation

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
35 minutes ago, Draco18s said:

You need to subscribe to the ModelRegistryEvent in order to register models for your items with ModelLoader.setCustomModelResourceLocation

 

Alright. I've simply added the blocks to my renderer using 

 

	@SubscribeEvent
	public void registerRenders(ModelRegistryEvent event){
		registerRender(Item.getItemFromBlock(RPVPBlocks.oreSilver));
		registerRender(Item.getItemFromBlock(RPVPBlocks.shrine));

	}

	private static void registerRender(Item item) {
		ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
	}

 

which seems to automatically render the item as a small block, no JSON needed. Though I see how I could make a custom icon using that.

 

Thanks.

Posted
44 minutes ago, oldcheese said:

which seems to automatically render the item as a small block, no JSON needed. Though I see how I could make a custom icon using that.

Blocks default to using the blockstate json to determine their model. (That's what the "inventory" or "normal" variant section is for)

Bare items use an item model json file (which is typically a subtype of item/generated which is itself a subtype of builtin/generated, which creates the model from a texture).

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.