Jump to content

[1.12.2] How do I make bedrock add stat to the player stat. [Solved]


Recommended Posts

Posted (edited)

I make bedrock breakable for 750.0f but then the bedrock wasn't added to the stat list. I don't know how how to add it to the stat list.

Edited by Issac29
Posted

You can't.

There's a function that sets stats off, but as it defaults to on, there's no method that turns the value back on.

 

And given that bedrock can't be broken by any means that would ever trigger stats, there's no point.

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 (edited)

Also because I made bedrock breakable but it takes a long time to break, there has to be a way.:|

 

Edit: the Hardness was negative one then at 450F.

Edited by Issac29
Forgot one
  • 2 weeks later...
Posted
On 5/25/2019 at 10:30 PM, Draco18s said:

And given that bedrock can't be broken by any means that would ever trigger stats, there's no point.

Normally bedrock is unbreakable but the changed code allows to make bedrock breakable with some edited java code.

Like This:

Blocks.BEDROCK.setHardness(30.0F)

 

Posted
14 minutes ago, Issac29 said:

Normally bedrock is unbreakable but the changed code allows to make bedrock breakable with some edited java code.

Like This:


Blocks.BEDROCK.setHardness(30.0F)

 

Yes, I know you can do that. At least, in 1.12. That won't always be true (and in fact, in 1.13 you can't: hardness and resistance were made final).

 

What I'm saying is that this function is called on bedrock:

 

disableStats()

 

This sets enableStats to falseenableStats is a protected field. There is no enableStatsAgain() method to set it back to true.

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 (edited)

I think I said something about that.

On 5/25/2019 at 10:30 PM, Draco18s said:

You can't.

There's a function that sets stats off, but as it defaults to on, there's no method that turns the value back on.

You could use reflection, but I don't know if that would be sufficient.

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
3 hours ago, Draco18s said:

That won't always be true (and in fact, in 1.13 you can't: hardness and resistance were made final).

Access Transformers exist.

25 minutes ago, Draco18s said:

You could use reflection

Or Access Transformers

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted

Access Transformers are not better than Reflection.

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

Access Transformers are not better than Reflection.

In some cases they are. They are better when you have a private/protected/package private Field that you want to get/set or you have a private/protected/package private Class that you want to access. They are also when you have a private Method that you want to call (not override). They are also the only solution (aside from ASM) to definalise a Class/Field/Method.

In all other cases Reflection should be used

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
3 hours ago, Cadiboo said:

They are also the only solution (aside from ASM) to definalise a Class/Field/Method.

This is not entirely true.

https://stackoverflow.com/questions/3301635/change-private-static-final-field-using-java-reflection

In fact I am pretty sure I saw similar code in forge at some point.

Doing this is not a good idea though.

 

3 hours ago, Cadiboo said:

In some cases they are. They are better when you have a private/protected/package private Field that you want to get/set or you have a private/protected/package private Class that you want to access.

 

"In some cases they are better than reflection. That is in ALL of access cases."

There is nothing wrong with using reflection and you should prefer reflection to ATs in most cases IMO. Use ATs if your reflective operation is too expensive(eg. called multiple times a frame).

Posted
2 hours ago, V0idWa1k3r said:

This is not entirely true.

https://stackoverflow.com/questions/3301635/change-private-static-final-field-using-java-reflection

In fact I am pretty sure I saw similar code in forge at some point.

 Doing this is not a good idea though.

Java 9 removed the ability to definalise Fields with Reflection.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
56 minutes ago, diesieben07 said:

The other applicable point is when you need to override a final (or private, although this is dangerous) method, which literally cannot be achieved using reflection at all.

Private instance methods cannot be overriden because the bytecode instructions in the class that uses it for them will still be INVOKE_SPECIAL rather than the INVOKE_VIRTUAL opcodes required for overriding to work. 

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted

I said that you can no longer definalise fields with Reflection (because of how it breaks the JVM) in Java 9. They definitely didn’t remove Reflection.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted

I use it on my mod to replace the fluid renderer (the field in BlockRendererDispatcher is final) to add smooth lighting and other stuff.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

  • 2 months later...

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.