Plex-FAWE/src/main/java/com/sk89q/worldedit/world/World.java

73 lines
3.3 KiB
Java
Raw Normal View History

/*
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
*
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
* (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.
*
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/>.
*/
2014-04-03 04:23:14 +00:00
package com.sk89q.worldedit.world;
import com.sk89q.worldedit.LocalWorld;
import com.sk89q.worldedit.Vector;
2014-04-03 04:23:14 +00:00
import com.sk89q.worldedit.blocks.BaseBlock;
import com.sk89q.worldedit.foundation.Block;
/**
* Represents a world instance that can be modified. The world instance could be
* loaded in-game or loaded in a stand-alone editor.
* </p>
* This class is meant to replace {@link LocalWorld} eventually, once this class has been
* fleshed out with the required methods and it has been decided that it is time to
* start breaking some API compatibility.
*/
public interface World {
/**
* Change the block at the given location to the given block. The operation may
2014-04-03 04:23:14 +00:00
* not tie the given {@link BaseBlock} to the world, so future changes to the
* {@link BaseBlock} do not affect the world until this method is called again.
* </p>
* Implementations may or may not consider the value of the notifyAdjacent
* parameter, and implementations may to choose to either apply physics anyway or
* to not apply any physics (particularly in a stand-alone implementation).
* </p>
* The return value of this method indicates whether the change "went through," as
* in the block was changed in the world in any way. If the new block is no different
* than the block already at the position in the world, 'false' would be returned.
* If the position is invalid (out of bounds, for example), then nothing should
* occur and 'false' should be returned. If possible, the return value should be
* accurate as possible, but implementations may choose to not provide an accurate
* value if it is not possible to know.
2014-04-03 04:23:14 +00:00
*
* @param location location of the block
* @param block block to set
* @param notifyAdjacent true to to notify adjacent (perform physics)
* @return true if the block was successfully set (return value may not be accurate)
*/
2014-04-03 04:23:14 +00:00
boolean setBlock(Vector location, BaseBlock block, boolean notifyAdjacent);
/**
* Get a copy of the block at the given location. May return null if the location
* given is out of bounds. The returned block must not be tied to any real block
* in the world, so changes to the returned {@link Block} have no effect until
2014-04-03 04:23:14 +00:00
* {@link #setBlock(Vector, BaseBlock, boolean)} is called.
*
* @param location location of the block
* @return the block, or null if the block does not exist
*/
2014-04-03 04:23:14 +00:00
BaseBlock getBlock(Vector location);
}