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
|
|
|
*
|
2014-04-04 22:03:18 +00:00
|
|
|
* This program is free software: you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU Lesser 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.
|
|
|
|
*
|
2014-04-04 22:03:18 +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 Lesser General Public License
|
|
|
|
* for more details.
|
2012-08-22 22:54:39 +00:00
|
|
|
*
|
2014-04-04 22:03:18 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
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
|
|
|
|
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;
|
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;
|
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;
|
2015-10-27 06:14:30 +00:00
|
|
|
import com.sk89q.worldedit.util.Direction;
|
2014-04-05 05:40:29 +00:00
|
|
|
import com.sk89q.worldedit.util.TreeGenerator;
|
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
|
|
|
|
|
|
|
/**
|
2014-04-05 05:40:29 +00:00
|
|
|
* Represents a world (dimension).
|
2012-08-22 22:54:39 +00:00
|
|
|
*/
|
2014-07-09 21:14:17 +00:00
|
|
|
public interface World extends Extent {
|
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();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
*
|
|
|
|
* @param position position of the block
|
2012-08-22 22:54:39 +00:00
|
|
|
* @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)
|
|
|
|
*/
|
2018-12-23 16:19:33 +00:00
|
|
|
boolean setBlock(BlockVector3 position, BlockStateHolder block, boolean notifyAndLight) throws WorldEditException;
|
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)
|
|
|
|
*/
|
2018-12-23 16:19:33 +00:00
|
|
|
int getBlockLightLevel(BlockVector3 position);
|
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
|
|
|
|
* @param item the item to drop
|
|
|
|
* @param count the number of individual stacks to drop (number of item entities)
|
|
|
|
*/
|
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
|
|
|
|
* @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
|
|
|
|
|
|
|
/**
|
|
|
|
* Regenerate an area.
|
|
|
|
*
|
|
|
|
* @param region the region
|
|
|
|
* @param editSession the {@link EditSession}
|
|
|
|
* @return true if re-generation was successful
|
|
|
|
*/
|
|
|
|
boolean regenerate(Region region, EditSession editSession);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Generate a tree at the given position.
|
|
|
|
*
|
|
|
|
* @param type the tree type
|
|
|
|
* @param editSession the {@link EditSession}
|
|
|
|
* @param position the position
|
|
|
|
* @return true if generation was successful
|
|
|
|
* @throws MaxChangedBlocksException thrown if too many blocks were changed
|
|
|
|
*/
|
2018-12-23 16:19:33 +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
|
|
|
|
* @param type the effect type
|
|
|
|
* @param data the effect data
|
|
|
|
* @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.
|
|
|
|
*
|
|
|
|
* @param server the server
|
|
|
|
* @param position the position
|
2018-06-17 05:42:47 +00:00
|
|
|
* @param blockType the block type
|
2014-04-05 05:40:29 +00:00
|
|
|
* @param priority the priority
|
|
|
|
* @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
|
|
|
|
* @param duration The duration of the weather
|
|
|
|
*/
|
|
|
|
void setWeather(WeatherType weatherType, long duration);
|
|
|
|
|
2014-04-05 05:40:29 +00:00
|
|
|
@Override
|
|
|
|
boolean equals(Object other);
|
|
|
|
|
|
|
|
@Override
|
|
|
|
int hashCode();
|
2012-08-22 22:54:39 +00:00
|
|
|
|
|
|
|
}
|