mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-04 03:56:41 +00:00
Copy paste/merge FAWE classes to this WorldEdit fork
- so certain people can look at the diff and complain about my sloppy code :( Signed-off-by: Jesse Boyd <jessepaleg@gmail.com>
This commit is contained in:
@ -19,23 +19,58 @@
|
||||
|
||||
package com.sk89q.worldedit.world.block;
|
||||
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.blocks.TileEntityBlock;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
import com.sk89q.worldedit.function.pattern.FawePattern;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
import com.sk89q.worldedit.registry.state.PropertyKey;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public interface BlockStateHolder<T extends BlockStateHolder> {
|
||||
public interface BlockStateHolder<T extends BlockStateHolder> extends FawePattern, TileEntityBlock {
|
||||
|
||||
/**
|
||||
* Get the block type
|
||||
*
|
||||
* @return The type
|
||||
*/
|
||||
BlockType getBlockType();
|
||||
BlockTypes getBlockType();
|
||||
|
||||
/**
|
||||
* Returns a BlockState with the given state and value applied.
|
||||
* Magic number (legacy uses)
|
||||
* @param propertyId
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
BlockStateHolder withPropertyId(int propertyId);
|
||||
|
||||
/**
|
||||
* Get combined id (legacy uses)
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
int getInternalId();
|
||||
|
||||
/**
|
||||
* Get type id (legacy uses)
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
int getInternalBlockTypeId();
|
||||
|
||||
/**
|
||||
* Get the block data (legacy uses)
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
int getInternalPropertiesId();
|
||||
|
||||
Mask toMask(Extent extent);
|
||||
|
||||
/**
|
||||
* Returns a BlockStateHolder with the given state and value applied.
|
||||
*
|
||||
* @param property The state
|
||||
* @param value The value
|
||||
@ -43,6 +78,15 @@ public interface BlockStateHolder<T extends BlockStateHolder> {
|
||||
*/
|
||||
<V> T with(final Property<V> property, final V value);
|
||||
|
||||
/**
|
||||
* Returns a BlockStateHolder with the given state and value applied.
|
||||
*
|
||||
* @param property The property key
|
||||
* @param value The value
|
||||
* @return The modified state, or same if could not be applied
|
||||
*/
|
||||
<V> BlockStateHolder with(final PropertyKey property, final V value);
|
||||
|
||||
/**
|
||||
* Gets the value at the given state
|
||||
*
|
||||
@ -51,6 +95,14 @@ public interface BlockStateHolder<T extends BlockStateHolder> {
|
||||
*/
|
||||
<V> V getState(Property<V> property);
|
||||
|
||||
/**
|
||||
* Gets the value at the given state
|
||||
*
|
||||
* @param property The state
|
||||
* @return The value
|
||||
*/
|
||||
<V> V getState(final PropertyKey property);
|
||||
|
||||
/**
|
||||
* Gets an immutable collection of the states.
|
||||
*
|
||||
@ -59,35 +111,20 @@ public interface BlockStateHolder<T extends BlockStateHolder> {
|
||||
Map<Property<?>, Object> getStates();
|
||||
|
||||
/**
|
||||
* Checks if the type is the same, and if the matched states are the same.
|
||||
*
|
||||
* @deprecated use masks - not try to this fuzzy/non fuzzy state nonsense
|
||||
* @param o other block
|
||||
* @return true if equal
|
||||
*/
|
||||
@Deprecated
|
||||
boolean equalsFuzzy(BlockStateHolder o);
|
||||
|
||||
/**
|
||||
* Returns an immutable {@link BlockState} from this BlockStateHolder.
|
||||
* Returns an immutable BlockStateHolder from this BlockStateHolder.
|
||||
*
|
||||
* @return A BlockState
|
||||
*/
|
||||
BlockState toImmutableState();
|
||||
|
||||
/**
|
||||
* Gets a {@link BaseBlock} from this BlockStateHolder.
|
||||
*
|
||||
* @return The BaseBlock
|
||||
*/
|
||||
BaseBlock toBaseBlock();
|
||||
|
||||
/**
|
||||
* Gets a {@link BaseBlock} from this BlockStateHolder.
|
||||
*
|
||||
* @param compoundTag The NBT Data to apply
|
||||
* @return The BaseBlock
|
||||
*/
|
||||
BaseBlock toBaseBlock(CompoundTag compoundTag);
|
||||
|
||||
default String getAsString() {
|
||||
if (getStates().isEmpty()) {
|
||||
return this.getBlockType().getId();
|
||||
|
Reference in New Issue
Block a user