Jump to content

[1.17] Base Minecraft resource access question.


Gespenst

Recommended Posts

Good day.

I am new to Minecraft modding. For a first project I decided it to be something simple - projectile launching tool.
What I want to do, is to have a "bow", that looks like Obsidian block and "fires" off other obsidian blocks.

I've implemented "ProjectileWeaponItem" class and made myself a custom bow, but I struggle with the model.

I want to use Obsidian model skin that the player would see naturally spawn.
I attempting to use 

BlockState blockState = Blocks.OBSIDIAN.defaultBlockState();
BakedModel bakedModel = Minecraft.getInstance().getBlockRenderer().getBlockModel(blockState);

I googled out some info and it lead me to mingling with "baked models" and etc.
But I don't think it's what I need, as I simply need a path to feed to code line bellow, as a "ResourceLocation" parameter. Or even use existing object and feed it back in.

withExistingParent(Registration.CUSTOMBOW.get().getRegistryName().getPath(), new ResourceLocation(Tutorial.MODID, "block/demo"));

 

So the question would be - which classes are responsible for storing resource paths to default Minecraft resources and how to interact with those?

Link to comment
Share on other sites

20 minutes ago, Gespenst said:

which classes are responsible for storing resource paths to default Minecraft resources

None of them. Resource paths are interpreted, not hard coded. It's formed via concatenation of $domain + ":" + $block_registry_name and later is it parsed to locate the actual file.

ALL assets are referenced this way.

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.

Link to comment
Share on other sites

49 minutes ago, Draco18s said:

None of them. Resource paths are interpreted, not hard coded. It's formed via concatenation of $domain + ":" + $block_registry_name and later is it parsed to locate the actual file.

ALL assets are referenced this way.

Neat! Thank you!

withExistingParent(Registration.CUSTOMBOW.get().getRegistryName().getPath(), Blocks.OBSIDIAN.getRegistryName());

Simply getting RegistryName was enough.

Tho it raises more questions. Does registry name always link to a texture resource? What about animations and vertice data?
I will have to google up more info on that topic.

Edited by Gespenst
Link to comment
Share on other sites

2 hours ago, Gespenst said:

Does registry name always link to a texture resource?

No. It can link to any asset. Loot tables, block states, models...

2 hours ago, Gespenst said:

What about animations and vertice data?

In theory yes, in practice no. There are no existing vanilla assets that are of this type, so they aren't supported. In theory you could make them be supported, but it would take a lot of work messing around with the internals.

Edited by Draco18s

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.

Link to comment
Share on other sites

On 9/24/2021 at 3:14 AM, Draco18s said:

No. It can link to any asset. Loot tables, block states, models...

In theory yes, in practice no. There are no existing vanilla assets that are of this type, so they aren't supported. In theory you could make them be supported, but it would take a lot of work messing around with the internals.

Not directly related to your answer, but does that mean, if I want to make an Obsidian Block into a projectile (extend projectile class), whilst retaining its default properties, I am out of luck and I have to "mess with internals"?

Maybe there is a way to unregister default Minecraft blocks and add fake ones? Impostors of sort.

Edited by Gespenst
Link to comment
Share on other sites

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.