Jump to content

Recommended Posts

Posted

I'm updating my mod to 1.14.4 (coming from 1.12.2) and a lot have changed.

Some of my blocks are relying on some "properties" from other blocks. For example resistance, hardness, mapcolor.

Are there any getters for those, or how would i retrieve those values?

An example for that is i have , in addition to the vanilla bricks, added 16 more (colored) bricks. They all need to have the same properties except the mapcolor as the vanilla bricks.

I can ofcourse add those properties at instantiation, but since they all are "the same" i want it to be inside the class. This way it saves me alot of work.

I have done this for 1.12.2. Now it doesn't work like that. So i wonder if there are other ways now.

Posted
11 hours ago, winnetrie said:

I can ofcourse add those properties at instantiation, but since they all are "the same" i want it to be inside the class.

Create class.
public SomeBlock(Properties properties) {

  super(properties.hardnessAndResistance(hardness, resistance));

}

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted (edited)
22 hours ago, Animefan8888 said:

Create class.
public SomeBlock(Properties properties) {

  super(properties.hardnessAndResistance(hardness, resistance));

}

Oh so i set them all in the super? I really like this "properties" thing

EDIT: How do i now "get" the hardness and resistance from an other block?

Edited by winnetrie
Posted
2 hours ago, winnetrie said:

I really like this "properties" thing

I don't. While that particular mod never got a 1.12 update (and a 1.14 update is as unlikely) the fact that those fields are locked down pretty hard is annoying for those of us who actually want shovels to freaking matter.

2 hours ago, winnetrie said:

How do i now "get" the hardness and resistance from an other block?

Blocks.IRON_ORE.getDefaultState().getBlockHardness(null, null)

As dirty as it seems passing null there, virtually no blocks should rely on it. No vanilla ones do.

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
20 minutes ago, Draco18s said:

While that particular mod never got a 1.12 update (and a 1.14 update is as unlikely) the fact that those fields are locked down pretty hard is annoying for those of us who actually want shovels to freaking matter.

Why not just use a constant? They can't change anymore. Now you have to override their registry.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted (edited)
23 minutes ago, Animefan8888 said:

Now you have to override their registry.

Because this is less mod compatible. Two mods overriding the same block, someone wins and someone loses.

Even if those two overrides are for completely unrelated things.

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.

Posted
11 minutes ago, Draco18s said:

Because this is less mod compatible. Two mods overriding the same block, someone wins and someone loses.

Even if those two overrides are for completely unrelated things.

This is true so best bet is to stay away from overrides and use events.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
10 hours ago, Draco18s said:

I don't. While that particular mod never got a 1.12 update (and a 1.14 update is as unlikely) the fact that those fields are locked down pretty hard is annoying for those of us who actually want shovels to freaking matter.

Blocks.IRON_ORE.getDefaultState().getBlockHardness(null, null)

As dirty as it seems passing null there, virtually no blocks should rely on it. No vanilla ones do.

Ah, i didn't know i could parse in a null. I never understood why there isn't just a simple method for it. Just 1 without parameters. Like other getters.

However i can set those values manually and perhaps this is more common to do, but how unlikely it will be, in future updates it's always posseble those values changes.

In this case if the blockhardness of bricks ever changes , my bricks their hardness will Always be the same. It is also less typing. I could maybe just make a constant for the value, so if it ever changes i just have to change the constant's value

 

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.