oddlama / vane

Immersive and lore friendly enhancements for vanilla Minecraft
MIT License
269 stars 32 forks source link

Limit creeper explosion reconstruction to owned areas #267

Open cyberfox opened 4 days ago

cyberfox commented 4 days ago

I like the reconstruction capability for creeper explosions, but I want them to be normally destructive when away from the places where players own their homes.

I don't know if the answer is an object that you have in your home that marks a zone around it as 'reconstructable', or using the existing region system, but it would be a really nice feature.

I haven't spent any time looking into the implementation, to see how hard this is yet.

oddlama commented 1 day ago

I agree this would be a nice feature.

Regarding implementation: If you want a setting per region-group, it's going to be quite some work. If you are fine with a global toggle then it's relatively simple and you can mostly copy existing code. Similar to the portals <-> regions integration, the admin module would need a callback like this one in portals, but slightly adjusted so it can check whether a coordinate is in a region.

https://github.com/oddlama/vane/blob/e71365b547f5b0dc2be48aae093a1785e37d99d9/vane-portals/src/main/java/org/oddlama/vane/portals/Portals.java#L352-L359

In the initialization of vane-regions, it will provide that callback to vane-admin if necessary (we want regions to softdepend on admin not the other way around). That can also be mostly copied from the RegionPortalIntegration.java as a new RegionAdminIntegration.java.

Then a single config needs to be added to vane-admin like only_in_regions which determines where the creeper rebuild applies. And in the explosion events just remove all blocks that are not in a region if that toggle is set.