2012-08-22 22:54:39 +00:00
|
|
|
/*
|
2014-04-04 22:03:18 +00:00
|
|
|
* WorldEdit, a Minecraft world manipulation toolkit
|
|
|
|
* Copyright (C) sk89q <http://www.sk89q.com>
|
|
|
|
* Copyright (C) WorldEdit team and contributors
|
2012-08-22 22:54:39 +00:00
|
|
|
*
|
2020-08-18 19:48:31 +00:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
2012-08-22 22:54:39 +00:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
2020-08-18 19:48:31 +00:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2012-08-22 22:54:39 +00:00
|
|
|
*
|
2020-08-18 19:48:31 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
2014-04-04 22:03:18 +00:00
|
|
|
*/
|
2012-08-22 22:54:39 +00:00
|
|
|
|
2014-04-03 04:23:14 +00:00
|
|
|
package com.sk89q.worldedit.world;
|
2012-08-22 22:54:39 +00:00
|
|
|
|
2021-07-23 15:48:51 +00:00
|
|
|
import com.fastasyncworldedit.core.queue.IChunkCache;
|
|
|
|
import com.fastasyncworldedit.core.queue.IChunkGet;
|
|
|
|
import com.fastasyncworldedit.core.queue.implementation.packet.ChunkPacket;
|
2014-07-09 21:14:17 +00:00
|
|
|
import com.sk89q.worldedit.EditSession;
|
|
|
|
import com.sk89q.worldedit.MaxChangedBlocksException;
|
|
|
|
import com.sk89q.worldedit.WorldEditException;
|
2015-10-27 06:14:30 +00:00
|
|
|
import com.sk89q.worldedit.blocks.BaseItem;
|
2014-04-05 05:40:29 +00:00
|
|
|
import com.sk89q.worldedit.blocks.BaseItemStack;
|
2019-10-30 11:26:52 +00:00
|
|
|
import com.sk89q.worldedit.entity.Player;
|
2014-06-28 02:55:38 +00:00
|
|
|
import com.sk89q.worldedit.extension.platform.Platform;
|
2014-04-05 05:40:29 +00:00
|
|
|
import com.sk89q.worldedit.extent.Extent;
|
|
|
|
import com.sk89q.worldedit.function.mask.Mask;
|
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>
2020-10-10 09:57:12 +00:00
|
|
|
import com.sk89q.worldedit.internal.util.DeprecationUtil;
|
|
|
|
import com.sk89q.worldedit.internal.util.NonAbstractForCompatibility;
|
2018-12-23 16:19:33 +00:00
|
|
|
import com.sk89q.worldedit.math.BlockVector2;
|
|
|
|
import com.sk89q.worldedit.math.BlockVector3;
|
|
|
|
import com.sk89q.worldedit.math.Vector3;
|
2014-04-05 05:40:29 +00:00
|
|
|
import com.sk89q.worldedit.regions.Region;
|
2019-08-06 15:29:49 +00:00
|
|
|
import com.sk89q.worldedit.registry.Keyed;
|
2015-10-27 06:14:30 +00:00
|
|
|
import com.sk89q.worldedit.util.Direction;
|
2020-03-08 06:09:36 +00:00
|
|
|
import com.sk89q.worldedit.util.SideEffect;
|
|
|
|
import com.sk89q.worldedit.util.SideEffectSet;
|
2014-04-05 05:40:29 +00:00
|
|
|
import com.sk89q.worldedit.util.TreeGenerator;
|
2020-09-18 10:52:49 +00:00
|
|
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
2018-10-15 10:50:09 +00:00
|
|
|
import com.sk89q.worldedit.world.block.BlockState;
|
2018-12-20 16:00:27 +00:00
|
|
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
|
|
|
import com.sk89q.worldedit.world.block.BlockType;
|
2018-07-19 12:41:26 +00:00
|
|
|
import com.sk89q.worldedit.world.weather.WeatherType;
|
2012-08-22 22:54:39 +00:00
|
|
|
|
2021-07-24 15:34:05 +00:00
|
|
|
import javax.annotation.Nullable;
|
2019-07-09 19:50:13 +00:00
|
|
|
import java.nio.file.Path;
|
2021-08-07 09:09:33 +00:00
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.Collections;
|
2019-08-06 15:29:49 +00:00
|
|
|
import java.util.Locale;
|
2020-03-08 06:09:36 +00:00
|
|
|
import java.util.Set;
|
2019-07-09 19:50:13 +00:00
|
|
|
|
2012-08-22 22:54:39 +00:00
|
|
|
/**
|
2014-04-05 05:40:29 +00:00
|
|
|
* Represents a world (dimension).
|
2012-08-22 22:54:39 +00:00
|
|
|
*/
|
2021-07-23 15:48:51 +00:00
|
|
|
//FAWE start - IChunkCache<IChunkGet>
|
2019-08-18 01:09:09 +00:00
|
|
|
public interface World extends Extent, Keyed, IChunkCache<IChunkGet> {
|
2021-07-23 15:48:51 +00:00
|
|
|
//FAWE end
|
2012-08-22 22:54:39 +00:00
|
|
|
|
|
|
|
/**
|
2014-04-05 05:40:29 +00:00
|
|
|
* Get the name of the world.
|
|
|
|
*
|
|
|
|
* @return a name for the world
|
|
|
|
*/
|
|
|
|
String getName();
|
|
|
|
|
2019-07-09 19:50:13 +00:00
|
|
|
/**
|
|
|
|
* Get the folder in which this world is stored. May return null if unknown
|
|
|
|
* or if this world is not serialized to disk.
|
|
|
|
*
|
|
|
|
* @return world storage path
|
|
|
|
*/
|
|
|
|
@Nullable
|
|
|
|
Path getStoragePath();
|
|
|
|
|
2020-08-18 19:48:31 +00:00
|
|
|
/**
|
|
|
|
* Get the minimum Y.
|
|
|
|
*
|
|
|
|
* @return the minimum Y
|
|
|
|
*/
|
|
|
|
int getMinY();
|
|
|
|
|
2014-04-05 05:40:29 +00:00
|
|
|
/**
|
|
|
|
* Get the maximum Y.
|
|
|
|
*
|
|
|
|
* @return the maximum Y
|
|
|
|
*/
|
|
|
|
int getMaxY();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a mask that matches all liquids.
|
2014-07-29 18:04:04 +00:00
|
|
|
*
|
|
|
|
* <p>Implementations should override this so that custom liquids
|
|
|
|
* are supported.</p>
|
2014-04-05 05:40:29 +00:00
|
|
|
*
|
|
|
|
* @return a mask
|
|
|
|
*/
|
|
|
|
Mask createLiquidMask();
|
|
|
|
|
2015-10-27 06:14:30 +00:00
|
|
|
/**
|
|
|
|
* Use the given item on the block at the given location on the given side.
|
|
|
|
*
|
|
|
|
* @param item The item
|
|
|
|
* @param face The face
|
|
|
|
* @return Whether it succeeded
|
|
|
|
*/
|
2018-12-23 16:19:33 +00:00
|
|
|
boolean useItem(BlockVector3 position, BaseItem item, Direction face);
|
2015-10-27 06:14:30 +00:00
|
|
|
|
2014-04-05 05:40:29 +00:00
|
|
|
/**
|
2018-12-23 16:19:33 +00:00
|
|
|
* Similar to {@link Extent#setBlock(BlockVector3, BlockStateHolder)} but a
|
2014-04-05 05:40:29 +00:00
|
|
|
* {@code notifyAndLight} parameter indicates whether adjacent blocks
|
|
|
|
* should be notified that changes have been made and lighting operations
|
|
|
|
* should be executed.
|
2014-07-29 18:04:04 +00:00
|
|
|
*
|
|
|
|
* <p>If it's not possible to skip lighting, or if it's not possible to
|
2014-04-05 05:40:29 +00:00
|
|
|
* avoid notifying adjacent blocks, then attempt to meet the
|
2014-07-29 18:04:04 +00:00
|
|
|
* specification as best as possible.</p>
|
|
|
|
*
|
|
|
|
* <p>On implementations where the world is not simulated, the
|
|
|
|
* {@code notifyAndLight} parameter has no effect either way.</p>
|
2014-04-05 05:40:29 +00:00
|
|
|
*
|
2021-07-24 15:34:05 +00:00
|
|
|
* @param position position of the block
|
|
|
|
* @param block block to set
|
2014-04-05 05:40:29 +00:00
|
|
|
* @param notifyAndLight true to to notify and light
|
2012-08-22 22:54:39 +00:00
|
|
|
* @return true if the block was successfully set (return value may not be accurate)
|
|
|
|
*/
|
2020-03-08 06:09:36 +00:00
|
|
|
@Deprecated
|
2021-07-24 15:34:05 +00:00
|
|
|
default <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block, boolean notifyAndLight) throws
|
|
|
|
WorldEditException {
|
2020-03-08 06:09:36 +00:00
|
|
|
return setBlock(position, block, notifyAndLight ? SideEffectSet.defaults() : SideEffectSet.none());
|
2019-05-28 20:31:22 +00:00
|
|
|
}
|
2014-04-05 05:40:29 +00:00
|
|
|
|
2020-03-08 06:09:36 +00:00
|
|
|
/**
|
|
|
|
* Similar to {@link Extent#setBlock(BlockVector3, BlockStateHolder)} but a
|
|
|
|
* {@code sideEffects} parameter indicates which side effects should be applied
|
|
|
|
* to the block. This includes block updates, lighting, and others. See {@link SideEffect}
|
|
|
|
* for a full list.
|
|
|
|
*
|
|
|
|
* <p>Not all implementations support all side effects. Use
|
|
|
|
* {@link Platform#getSupportedSideEffects()} for a list of supported side effects.
|
|
|
|
* Non-supported side effects will be ignored.</p>
|
|
|
|
*
|
2021-07-24 15:34:05 +00:00
|
|
|
* @param position position of the block
|
|
|
|
* @param block block to set
|
2020-03-08 06:09:36 +00:00
|
|
|
* @param sideEffects which side effects to perform
|
|
|
|
* @return true if the block was successfully set (return value may not be accurate)
|
|
|
|
*/
|
2021-07-24 15:34:05 +00:00
|
|
|
<B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 position, B block, SideEffectSet sideEffects) throws
|
|
|
|
WorldEditException;
|
2020-03-08 06:09:36 +00:00
|
|
|
|
2018-10-15 10:50:09 +00:00
|
|
|
/**
|
|
|
|
* Notifies the simulation that the block at the given location has
|
|
|
|
* been changed and it must be re-lighted (and issue other events).
|
|
|
|
*
|
2021-07-24 15:34:05 +00:00
|
|
|
* @param position position of the block
|
2018-10-15 10:50:09 +00:00
|
|
|
* @param previousType the type of the previous block that was there
|
|
|
|
* @return true if the block was successfully notified
|
|
|
|
*/
|
2020-03-08 06:09:36 +00:00
|
|
|
@Deprecated
|
|
|
|
default boolean notifyAndLightBlock(BlockVector3 position, BlockState previousType) throws WorldEditException {
|
|
|
|
return !applySideEffects(position, previousType, SideEffectSet.defaults()).isEmpty();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Applies a set of side effects on the given block.
|
|
|
|
*
|
2021-07-24 15:34:05 +00:00
|
|
|
* @param position position of the block
|
|
|
|
* @param previousType the type of the previous block that was there
|
2020-03-08 06:09:36 +00:00
|
|
|
* @param sideEffectSet which side effects to perform
|
|
|
|
* @return a set of side effects that were applied
|
|
|
|
*/
|
2021-07-24 15:34:05 +00:00
|
|
|
Set<SideEffect> applySideEffects(BlockVector3 position, BlockState previousType, SideEffectSet sideEffectSet) throws
|
|
|
|
WorldEditException;
|
2018-10-15 10:50:09 +00:00
|
|
|
|
2014-04-05 05:40:29 +00:00
|
|
|
/**
|
|
|
|
* Get the light level at the given block.
|
|
|
|
*
|
|
|
|
* @param position the position
|
|
|
|
* @return the light level (0-15)
|
|
|
|
*/
|
2019-07-22 20:58:18 +00:00
|
|
|
default int getBlockLightLevel(BlockVector3 position) {
|
|
|
|
return getBlock(position).getMaterial().getLightValue();
|
|
|
|
}
|
2014-04-05 05:40:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Clear a chest's contents.
|
|
|
|
*
|
|
|
|
* @param position the position
|
|
|
|
* @return true if the container was cleared
|
|
|
|
*/
|
2018-12-23 16:19:33 +00:00
|
|
|
boolean clearContainerBlockContents(BlockVector3 position);
|
2014-04-05 05:40:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Drop an item at the given position.
|
|
|
|
*
|
|
|
|
* @param position the position
|
2021-07-24 15:34:05 +00:00
|
|
|
* @param item the item to drop
|
|
|
|
* @param count the number of individual stacks to drop (number of item entities)
|
2014-04-05 05:40:29 +00:00
|
|
|
*/
|
2018-12-23 16:19:33 +00:00
|
|
|
void dropItem(Vector3 position, BaseItemStack item, int count);
|
2014-04-05 05:40:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Drop one stack of the item at the given position.
|
|
|
|
*
|
|
|
|
* @param position the position
|
2021-07-24 15:34:05 +00:00
|
|
|
* @param item the item to drop
|
2018-12-23 16:19:33 +00:00
|
|
|
* @see #dropItem(Vector3, BaseItemStack, int) shortcut method to specify the number of stacks
|
2014-04-05 05:40:29 +00:00
|
|
|
*/
|
2018-12-23 16:19:33 +00:00
|
|
|
void dropItem(Vector3 position, BaseItemStack item);
|
2014-04-05 05:40:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Simulate a block being mined at the given position.
|
|
|
|
*
|
|
|
|
* @param position the position
|
|
|
|
*/
|
2018-12-23 16:19:33 +00:00
|
|
|
void simulateBlockMine(BlockVector3 position);
|
2014-04-05 05:40:29 +00:00
|
|
|
|
2021-08-07 09:09:33 +00:00
|
|
|
//FAWE start
|
2021-09-08 15:39:43 +00:00
|
|
|
|
2021-08-07 09:09:33 +00:00
|
|
|
/**
|
|
|
|
* Return items that may drop by destroying this block.
|
|
|
|
*
|
|
|
|
* @param position the position
|
|
|
|
* @return Block drops
|
|
|
|
*/
|
|
|
|
default Collection<BaseItemStack> getBlockDrops(BlockVector3 position) {
|
|
|
|
return Collections.emptyList();
|
|
|
|
}
|
|
|
|
//FAWE end
|
|
|
|
|
2021-07-14 12:40:20 +00:00
|
|
|
/**
|
|
|
|
* Gets whether the given {@link BlockState} can be placed here.
|
|
|
|
*
|
2021-07-24 15:34:05 +00:00
|
|
|
* @param position The position
|
2021-07-14 12:40:20 +00:00
|
|
|
* @param blockState The blockstate
|
|
|
|
* @return If it can be placed
|
|
|
|
*/
|
|
|
|
default boolean canPlaceAt(BlockVector3 position, BlockState blockState) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-04-05 05:40:29 +00:00
|
|
|
/**
|
|
|
|
* Regenerate an area.
|
|
|
|
*
|
2021-07-24 15:34:05 +00:00
|
|
|
* @param region the region
|
2014-04-05 05:40:29 +00:00
|
|
|
* @param editSession the {@link EditSession}
|
|
|
|
* @return true if re-generation was successful
|
|
|
|
*/
|
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>
2020-10-10 09:57:12 +00:00
|
|
|
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.
|
|
|
|
*
|
2021-07-24 15:34:05 +00:00
|
|
|
* @param region the region
|
|
|
|
* @param extent the {@link Extent}
|
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>
2020-10-10 09:57:12 +00:00
|
|
|
* @param options the regeneration options
|
|
|
|
* @return true if regeneration was successful
|
|
|
|
*/
|
|
|
|
@NonAbstractForCompatibility(
|
|
|
|
delegateName = "regenerate",
|
2021-07-24 15:34:05 +00:00
|
|
|
delegateParams = {Region.class, EditSession.class}
|
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>
2020-10-10 09:57:12 +00:00
|
|
|
)
|
|
|
|
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");
|
|
|
|
}
|
2014-04-05 05:40:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Generate a tree at the given position.
|
|
|
|
*
|
2021-07-24 15:34:05 +00:00
|
|
|
* @param type the tree type
|
2014-04-05 05:40:29 +00:00
|
|
|
* @param editSession the {@link EditSession}
|
2021-07-24 15:34:05 +00:00
|
|
|
* @param position the position
|
2014-04-05 05:40:29 +00:00
|
|
|
* @return true if generation was successful
|
|
|
|
* @throws MaxChangedBlocksException thrown if too many blocks were changed
|
|
|
|
*/
|
2021-07-24 15:34:05 +00:00
|
|
|
boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, BlockVector3 position) throws
|
|
|
|
MaxChangedBlocksException;
|
2014-04-05 05:40:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Load the chunk at the given position if it isn't loaded.
|
|
|
|
*
|
|
|
|
* @param position the position
|
|
|
|
*/
|
2018-12-23 16:19:33 +00:00
|
|
|
void checkLoadedChunk(BlockVector3 position);
|
2014-04-05 05:40:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Fix the given chunks after fast mode was used.
|
2014-07-29 18:04:04 +00:00
|
|
|
*
|
2018-12-23 16:19:33 +00:00
|
|
|
* <p>Fast mode makes calls to {@link #setBlock(BlockVector3, BlockStateHolder, boolean)}
|
2014-04-05 05:40:29 +00:00
|
|
|
* with {@code false} for the {@code notifyAndLight} parameter, which
|
|
|
|
* may causes lighting errors to accumulate. Use of this method, if
|
|
|
|
* it is implemented by the underlying world, corrects those lighting
|
2014-07-29 18:04:04 +00:00
|
|
|
* errors and may trigger block change notifications.</p>
|
2014-04-05 05:40:29 +00:00
|
|
|
*
|
|
|
|
* @param chunks a list of chunk coordinates to fix
|
|
|
|
*/
|
2018-12-23 16:19:33 +00:00
|
|
|
void fixAfterFastMode(Iterable<BlockVector2> chunks);
|
2014-04-05 05:40:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Relight the given chunks if possible.
|
|
|
|
*
|
|
|
|
* @param chunks a list of chunk coordinates to fix
|
|
|
|
*/
|
2018-12-23 16:19:33 +00:00
|
|
|
void fixLighting(Iterable<BlockVector2> chunks);
|
2014-04-05 05:40:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Play the given effect.
|
|
|
|
*
|
|
|
|
* @param position the position
|
2021-07-24 15:34:05 +00:00
|
|
|
* @param type the effect type
|
|
|
|
* @param data the effect data
|
2014-04-05 05:40:29 +00:00
|
|
|
* @return true if the effect was played
|
|
|
|
*/
|
2018-12-23 16:19:33 +00:00
|
|
|
boolean playEffect(Vector3 position, int type, int data);
|
2014-04-05 05:40:29 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Queue a block break effect.
|
|
|
|
*
|
2021-07-24 15:34:05 +00:00
|
|
|
* @param server the server
|
|
|
|
* @param position the position
|
2018-06-17 05:42:47 +00:00
|
|
|
* @param blockType the block type
|
2021-07-24 15:34:05 +00:00
|
|
|
* @param priority the priority
|
2014-04-05 05:40:29 +00:00
|
|
|
* @return true if the effect was played
|
|
|
|
*/
|
2018-12-23 16:19:33 +00:00
|
|
|
boolean queueBlockBreakEffect(Platform server, BlockVector3 position, BlockType blockType, double priority);
|
2014-04-05 05:40:29 +00:00
|
|
|
|
2018-07-19 12:41:26 +00:00
|
|
|
/**
|
|
|
|
* Gets the weather type of the world.
|
|
|
|
*
|
|
|
|
* @return The weather
|
|
|
|
*/
|
|
|
|
WeatherType getWeather();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the remaining weather duration.
|
|
|
|
*
|
|
|
|
* @return The weather duration
|
|
|
|
*/
|
|
|
|
long getRemainingWeatherDuration();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the weather type of the world.
|
|
|
|
*
|
|
|
|
* @param weatherType The weather type
|
|
|
|
*/
|
|
|
|
void setWeather(WeatherType weatherType);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the weather type of the world.
|
|
|
|
*
|
|
|
|
* @param weatherType The weather type
|
2021-07-24 15:34:05 +00:00
|
|
|
* @param duration The duration of the weather
|
2018-07-19 12:41:26 +00:00
|
|
|
*/
|
|
|
|
void setWeather(WeatherType weatherType, long duration);
|
|
|
|
|
2018-12-21 07:05:30 +00:00
|
|
|
/**
|
|
|
|
* Gets the spawn position of this world.
|
|
|
|
*
|
|
|
|
* @return The spawn position
|
|
|
|
*/
|
|
|
|
BlockVector3 getSpawnPosition();
|
|
|
|
|
2014-04-05 05:40:29 +00:00
|
|
|
@Override
|
|
|
|
boolean equals(Object other);
|
|
|
|
|
|
|
|
@Override
|
|
|
|
int hashCode();
|
2012-08-22 22:54:39 +00:00
|
|
|
|
2021-07-23 15:48:51 +00:00
|
|
|
//FAWE start
|
2019-07-18 16:07:31 +00:00
|
|
|
@Override
|
|
|
|
default boolean isWorld() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-08-06 15:29:49 +00:00
|
|
|
@Override
|
|
|
|
default String getId() {
|
|
|
|
return getName().replace(" ", "_").toLowerCase(Locale.ROOT);
|
|
|
|
}
|
2019-08-18 01:09:09 +00:00
|
|
|
|
2019-08-23 07:36:33 +00:00
|
|
|
/**
|
2020-08-18 19:48:31 +00:00
|
|
|
* Refresh a specific chunk.
|
2019-08-23 07:36:33 +00:00
|
|
|
* Note: only 0 is guaranteed to send all tiles / entities
|
|
|
|
* Note: Only 65535 is guaranteed to send all blocks
|
|
|
|
*/
|
2019-11-11 21:22:03 +00:00
|
|
|
void refreshChunk(final int chunkX, final int chunkZ);
|
2019-08-23 07:36:33 +00:00
|
|
|
|
2019-08-18 01:09:09 +00:00
|
|
|
@Override
|
|
|
|
IChunkGet get(int x, int z);
|
2019-10-30 11:26:52 +00:00
|
|
|
|
|
|
|
/**
|
2020-08-18 19:48:31 +00:00
|
|
|
* Send a fake chunk to a player.
|
2021-07-24 15:34:05 +00:00
|
|
|
*
|
2019-10-30 11:26:52 +00:00
|
|
|
* @param player may be null to send to everyone
|
|
|
|
* @param packet the chunk packet
|
|
|
|
*/
|
|
|
|
void sendFakeChunk(@Nullable Player player, ChunkPacket packet);
|
2020-09-18 10:52:49 +00:00
|
|
|
|
2021-07-24 15:34:05 +00:00
|
|
|
@Override
|
|
|
|
@Nullable
|
2020-09-18 10:52:49 +00:00
|
|
|
default BiomeType getBiome(BlockVector3 position) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
default boolean setBiome(int x, int y, int z, BiomeType biome) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
default boolean setBiome(BlockVector3 position, BiomeType biome) {
|
|
|
|
return false;
|
|
|
|
}
|
2021-01-09 21:27:55 +00:00
|
|
|
|
|
|
|
void flush();
|
2021-07-23 15:48:51 +00:00
|
|
|
//FAWE end
|
2012-08-22 22:54:39 +00:00
|
|
|
}
|