Biomes O' Plenty

Biomes O' Plenty

151M Downloads

Fire Decorate Events rather than cancel them

Ivorforce opened this issue ยท 3 comments

commented

The Problem

Since the latest few versions, my mod Recurrent Complex has a decoration (e.g. trees) replacement engine. For it to work, the decorations are expected to scattered determined by the vanilla biome decorator (e.g. treesPerBiome). Since BoP doesn't use the vanilla engine, and instead sets all the default decoration values to 0, the tree replacements don't trigger and BoP's trees are being spawned as usual.

I'd like to be able to provide compatibility with your system.

Solution Proposal

I've designed a Forge PR (3318) to enable all mods this compatibility. In short, the Decorate event starts providing 3 methods: boolean hasAmountData(), int getModifiedAmount and setModifiedAmount(int).

However, LexManos doesn't seem to want to merge it anytime soon, so in Ivorforce/RecurrentComplex#96 I've decided on implementing it anyway, which whichonespink44 did for RTG in Team-RTG/Realistic-Terrain-Generation#1011.

I've looked up how BoP currently handles decoration, and it seems to cancel the vanilla decoration event and insert their own.
That would be an acceptable solution (though incompatible with my proposal) if the event promised to fire just once per biome. However, that is already not the case. Amount data or not, imo this approach is not viable even with the current state of the event.

Implementation Proposal

I'd suggest hooking into BiomeDecorationEvent.Pre and run over your decoration types manually (while either canceling the vanilla events, or even better just pronouncing them useless by setting treesPerBiome etc. to -999 (which you already do).

Then you'd be able to fire subclasses of the decoration events yourself that include the amount (hasAmountData , getAmoundData, setAmountData) of decoration objects being spawned, which ReC and other mods can use and/or cancel for mod interaction. You'd also be able to add more context data to the subclasses (a proposal by Lex himself).

Feel free to add suggestions of how to better approach the problem, as I'm not super familiar with how BoP likes to handle things.

commented

@Ivorforce since BoP isn't really currently being worked on, doing a PR with this might be the best way to go for you (Since PRs still gets reviewed) :)

commented

Would you be able to PM me on Discord? Admittedly I've been putting this off for awhile since I'm a bit sceptical about a few things, but at this point it's been long enough

commented

Closing this because we either can't/won't fix it or it's not an issue in 1.13