SvenKayser / JMOD

The Javascript MOD Loader
Other
8 stars 3 forks source link

[1.70.10] Can not change ToolMaterial #2

Closed nmarshall23 closed 7 years ago

nmarshall23 commented 8 years ago

I'm testing JMOD as a replacement for squidutils.

I find I can not change the ToolMaterial, for the Hammerz in the hammerz mod

Is there a way of seeing debugging info on why JMOD can't change those ToolMaterial?

ghost commented 8 years ago

I will have to dig into this mod to see how the tool materials are coded. If JMOD cannot change a tool Material it complains, so chances are that those Hammerz extend the Tool Class, but use a different mechanism than vanilla tools do.

Just to be clear: Are you trying to change a tools material's properties, and the new properties are not applied correctly, or try to assign a new tool material altogether?

nmarshall23 commented 8 years ago

I am trying to change the tools material harvest level, along with the Durability .

Changes to vanilla tools material are applied fine. It's just tools materials added by the Hammerz mod. To clarify, the Diamond Hammer has the harvest level and durability I have set in JMOD. However when I set Copper as defined in the Hammerz Mod, my changes are not set on those tools.

Here is a link to the Hammer Item source.

I have a feeling this bug is caused by when in the Mod Init's order items are created. That because Hammerz Mod creates it's Hammers and tools material in the preInit() step, it's not possible, to change them.

ghost commented 8 years ago

JMOD patches Tool Material Values far later than that to accommodate for exactly such instances. I'll have to dig deeper into that.

SvenKayser commented 7 years ago

As of now I'm putting this rather far back on the list of priorities. If you have an idea how to solve this feel free to get it working yourself and give me PR when done.

nmarshall23 commented 7 years ago

Good to see that your are back. I have fixed this in my branch, I too found it very confusing. I will prepare a merge for you.

SvenKayser commented 7 years ago

That's amazing. Thank you!

SvenKayser commented 7 years ago

Fixed as of https://github.com/SvenKayser/JMOD/pull/36/commits/e6d110a24817f2546a76a48d74bd45aba759bbb9 thanks to nmarshall23