MinecraftForge icon indicating copy to clipboard operation
MinecraftForge copied to clipboard

Allow adding to Weathering and Waxing maps

Open bageldotjpg opened this issue 4 years ago • 9 comments

Currently, it is impossible to add to WeatheringCopper's NEXT_BY_BLOCK map, which makes it quite hard to add new copper blocks that can oxidize. Making a HashBiMap instead makes it a lot easier as modders can just add to the map directly by getting the value in the supplier. While it is possible to make stuff oxidize without adding to this map, it would require a lot more work to get all the quirks functional especially stuff such as lightning reversing, when it can be made easier just by being able to add to this map.

The same kind of map is used in HoneycombItem's WAXABLES to determine what copper blocks can be waxed and scraped off, making this a HashBiMap also makes it simpler to modify.

A test mod is included, registering new copper blocks, that can be observed to be oxidizing over time (though, you may want to turn up the tick speed). You can also confirm that lightning reverses the custom copper's oxidation, and axes can scrape off the oxidation. There is also a test that shows the HoneycombItem's WAXABLES map is updated, using dirt and sand. Axe scraping works here as well.

bageldotjpg avatar Jan 08 '22 17:01 bageldotjpg

This can be done without any patches and instead using an AT and then setting the field. Forge should do that and then provide methods to add to them in the MInecraftForge class instead of this huge patch.

diesieben07 avatar Jan 08 '22 17:01 diesieben07

Oops, you are right about WAXABLES but I am pretty sure NEXT_BY_BLOCK can not be AT'd.

bageldotjpg avatar Jan 08 '22 17:01 bageldotjpg

Why not?

diesieben07 avatar Jan 08 '22 17:01 diesieben07

Not sure, just did some testing and WAXABLES updates and runs just fine when I AT it but NEXT_BY_BLOCK does not. It no longer has the red line under it in IntelliJ but running says I cannot assign a value to it because its final, unlike WAXABLES.

bageldotjpg avatar Jan 08 '22 18:01 bageldotjpg

wow

thelegitdolt avatar Jan 10 '22 22:01 thelegitdolt

This has been updated as last discussed in github-discussions, not sure if any other changing needs being done

bageldotjpg avatar Jan 11 '22 01:01 bageldotjpg

As a quick question, is there a reason why this injects into the map instead of adding an extension method in IForgeBlock? This seems like a similar usecase of how Forge handled flammability by the FireBlock or burn time for furnaces.

ChampionAsh5357 avatar May 13 '22 11:05 ChampionAsh5357

I think waxing is better done by adding a ToolAction.

For weathering, it may make more sense to have custom blocks override getNext, and add a defaulted getFirst method that can likewise be called from lightning.

Random832 avatar May 13 '22 14:05 Random832

Hello! @bageldotjpg, please leave a comment whether you wish to continue this PR and update it to the latest active version of 1.19.2 (or leave an explanation why this PR's changes are not applicable to 1.19.2). If we do not hear back from you after some time, this PR will be closed for inactivity.

If anyone else wishes to continue the work of this PR, please create a PR with a link to this PR for reference. Thank you for your contributions. 👋

sciwhiz12 avatar Aug 27 '22 18:08 sciwhiz12

Hello! As per my previous comment, we will be closing this PR for inactivity. If you or another contributor wishes to continue the work of this PR, please create a new PR with a link to this PR for reference. Thank you for your contributions. 👋

sciwhiz12 avatar Oct 12 '22 09:10 sciwhiz12