FTBTeam / FTB-Mods-Issues

Any mod issues, be it FTB Teams, Quests or any other of our mods can be reported here!
23 stars 1 forks source link

[Feature Request]: "no_wilderness" per world #866

Closed Lezers closed 4 months ago

Lezers commented 1 year ago

Mod

FTB Chunks

Description

I need to know if there is a way to configure "no_wilderness" per world, for example, leave it activated in the overworld but not in the nether

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

desht commented 1 year ago

There isn't currently, although that would be a useful thing to have, and not hard to add.

Lezers commented 1 year ago

Is it possible to achieve this functionality with kubejs? I've seen this on a server

desht commented 1 year ago

The mod does fire Architectury events before and after a chunk is claimed (the before event is cancellable).

As for KJS, I just checked and there is some commented-out code in the mod to fire equivalent KJS events, which would allow control. So it looks like it did work, but is currently disabled.

That's something else I can look at adding back. Not sure why it was disabled, possibly when it was last ported to a new Minecraft version.

Lezers commented 1 year ago

if you can make this work and can show me how i would appreciate it

desht commented 1 year ago

That's the thing, it doesn't work right now. I am working on re-adding KJS support to the next Chunks release (it does need updating to the current KJS api, as I suspected). Once that's out, I'll add an example of using KJS events to prevent chunk claiming operations.

desht commented 1 year ago

KJS 6.0 (6.1 coming soon) support is in the new Chunks (in the process of being released to Curseforge now). An example of how to use it:

FTBChunksEvents.before('claim', event => {
        console.info('about to claim chunk! ' + event.getPlayer())
        console.info(event.getLevel())
        console.info(event.getClaimPos())
        if (event.getClaimPos().getX() > 350) {
                event.setCustomResult('some.translation.key')
        }
})

FTBChunksEvents.after('load', event => {
        console.info("after force-load! " + event.getClaimPos())
})

In this contrived example the before('claim') handler is used to block chunk claiming if the chunk claim pos X position is > 350. getClaimPos() returns the (minX, 0, minZ) block pos of the chunk being claimed.

event.setCustomResult() is used for "before" events to cancel the event, and you pass a translation key for the message you want the client GUI to display to the player.

"after" events can't be cancelled - the example here is just for informational purposes.

Operations are 'claim', 'unclaim', 'load' and 'unload', and there are "before" and "after" events for all 4 operations.

desht commented 1 year ago

But per-dimension wilderness building can also be disabled in this release, and that will probably be simpler if you just want to control building by dimension. You can add dimension ID's (e.g. minecraft:the_nether) to the "Claim Blacklist" list config setting, either via the GUI or by editing serverconfig/ftbchunks-world.snbt.