Re-Implement //regen (#598)

* start reimplementing regen command

* start reimplementing regen command

* Formatting and logic tweaks.

Regen will now throw exceptions but they are not caught yet.
ConversionSessions will now be closed when no longer being used instead of left open.

* fix //regen crashing server

* added //regen support for 1.16.1 and 1.15.2

* cleanup

* Update the issue template

* improve performance of regen by a factor of 40, approx 1.2 millon blocks/second

* Update the issue template

* Update the issue template & add a config (#640)

* Update the issue template

* Add a config.yml to the issue template

* improve performance of regen by a factor of 40, approx 1.2 millon blocks/second

* Fix entity rotation (#642)

* fix entity rotation
fixes #577 
Co-authored-by: wea_ondara <wea_ondara@alpenblock.net>

* Fix toggle permission (#644)

* Fixes #529
* fix superperms perm toggling

Co-authored-by: @weaondara <wea_ondara@alpenblock.net>

* Fix #647

* Squash errors and debug to aid fixing #652 properly

* cleanup imports

* cleanup imports 2

* cleanup imports 3

* cleanup imports 4

* add patch by @SirYwell

* aysnc world gen with features and stuff and some minor issues

* optimizations, full chunkstatus, block populators

* optimizations, cleanup

* optimizations

* fix feature regeneration, fix temp folder deletion

* cleanup

* make chunk gen multithreaded

* fix precomputation of chunk lists for RegionLimitedWorldAccess again

* added regenerator abstraction, fix aioobe while running through chunk stati

* remove override for getChunkAt in freshnmsworld

* don't use concurrent chunk gen if custom chunk generators do not support it

* distinct between generator types

* improve regen speed for overworlds

* mix

* Add message that regen might take a while

* use a shared map for FastAreaLazy, cleanup imports

* use custom concurrency levels for chunk stati and process accordingly

* implement new regen in 1.15.2 and 1.16.1 as well

Conflicts:
	worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/FAWE_Spigot_v1_15_R2.java
	worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/FAWE_Spigot_v1_16_R1.java

* woops

* further abstraction, finalized regen impl

* Formatting

* Fix some typos, remove debug

* replace wildcard imports

* cleanup debug

* braces

* serr -> logger

* move regen impls to seperate classes

* fix world init for 1.16.1

* fix world init for 1.15.2

* fix world init for 1.15.2 #2

* use original world name for regeneration

* Update Regen_v1_15_R2.java

* Update worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/FAWE_Spigot_v1_15_R2.java

Co-authored-by: Matt <4009945+MattBDev@users.noreply.github.com>

* Update worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/FAWE_Spigot_v1_15_R2.java

Co-authored-by: Matt <4009945+MattBDev@users.noreply.github.com>

* Update worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/FAWE_Spigot_v1_16_R1.java

Co-authored-by: Matt <4009945+MattBDev@users.noreply.github.com>

* improve documentation, use parallel task count for fawe settings

* fix compile

Co-authored-by: wea_ondara <wea_ondara@alpenblock.net>
Co-authored-by: MattBDev <4009945+MattBDev@users.noreply.github.com>
Co-authored-by: dordsor21 <dordsor21@gmail.com>
This commit is contained in:
Aurora
2020-10-10 11:57:12 +02:00
committed by GitHub
parent d42e152348
commit 3c6280b11e
14 changed files with 2155 additions and 311 deletions

View File

@ -616,6 +616,7 @@ public class RegionCommands {
try {
session.setMask((Mask) null);
session.setSourceMask((Mask) null);
actor.printInfo(TranslatableComponent.of("fawe.regen.time"));
success = world.regenerate(region, editSession);
} finally {
session.setMask(mask);

View File

@ -186,7 +186,7 @@ public interface Extent extends InputExtent, OutputExtent {
}
default boolean regenerateChunk(int x, int z, @Nullable BiomeType type, @Nullable Long seed) {
throw new UnsupportedOperationException("TODO NOT IMPLEMENTED: " + isWorld());
return false;
}
/*

View File

@ -31,6 +31,7 @@ import com.sk89q.worldedit.blocks.BaseItemStack;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.regions.Region;
@ -226,6 +227,10 @@ public class NullWorld extends AbstractWorld {
@Override
public void sendFakeChunk(@Nullable Player player, ChunkPacket packet) {
}
@Override
public boolean regenerate(Region region, Extent extent, RegenOptions options) {
return false;
}
}

View File

@ -31,6 +31,8 @@ import com.sk89q.worldedit.entity.Player;
import com.sk89q.worldedit.extension.platform.Platform;
import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.function.mask.Mask;
import com.sk89q.worldedit.internal.util.DeprecationUtil;
import com.sk89q.worldedit.internal.util.NonAbstractForCompatibility;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3;
@ -218,7 +220,44 @@ public interface World extends Extent, Keyed, IChunkCache<IChunkGet> {
* @param editSession the {@link EditSession}
* @return true if re-generation was successful
*/
boolean regenerate(Region region, EditSession editSession);
default boolean regenerate(Region region, EditSession editSession) {
return regenerate(region, editSession, RegenOptions.builder().build());
}
/**
* Regenerate an area.
*
* @param region the region
* @param extent the {@link Extent}
* @return true if re-generation was successful
*/
default boolean regenerate(Region region, Extent extent) {
return regenerate(region, extent, RegenOptions.builder().build());
}
/**
* Regenerate an area.
*
* @param region the region
* @param extent the {@link Extent}
* @param options the regeneration options
* @return true if regeneration was successful
* @apiNote This must be overridden by new subclasses. See {@link NonAbstractForCompatibility}
* for details
*/
@NonAbstractForCompatibility(
delegateName = "regenerate",
delegateParams = { Region.class, EditSession.class }
)
default boolean regenerate(Region region, Extent extent, RegenOptions options) {
DeprecationUtil.checkDelegatingOverride(getClass());
if (extent instanceof EditSession) {
return regenerate(region, (EditSession) extent);
}
throw new UnsupportedOperationException("This World class ("
+ getClass().getName()
+ ") does not implement the general Extent variant of this method");
}
/**
* Generate a tree at the given position.

View File

@ -165,6 +165,8 @@
"fawe.tips.tip.biome.pattern": "Tip: The #biome[forest] pattern can be used in any command",
"fawe.tips.tip.biome.mask": "Tip: Restrict to a biome with the `$jungle` mask",
"fawe.regen.time": "Regenerating region, this might take a while!",
"worldedit.expand.description.vert": "Vertically expand the selection to world limits.",
"worldedit.expand.expanded": "Region expanded {0} blocks",
"worldedit.expand.expanded.vert": "Region expanded {0} blocks (top-to-bottom).",