mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-02 11:26:42 +00:00
Further work on BlockState transition
This commit is contained in:
@ -21,6 +21,7 @@ package com.sk89q.worldedit.function.pattern;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.type.BlockStateHolder;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
@ -29,14 +30,14 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
*/
|
||||
public class BlockPattern extends AbstractPattern {
|
||||
|
||||
private BaseBlock block;
|
||||
private BlockStateHolder block;
|
||||
|
||||
/**
|
||||
* Create a new pattern with the given block.
|
||||
*
|
||||
* @param block the block
|
||||
*/
|
||||
public BlockPattern(BaseBlock block) {
|
||||
public BlockPattern(BlockStateHolder block) {
|
||||
setBlock(block);
|
||||
}
|
||||
|
||||
@ -45,7 +46,7 @@ public class BlockPattern extends AbstractPattern {
|
||||
*
|
||||
* @return the block that is always returned
|
||||
*/
|
||||
public BaseBlock getBlock() {
|
||||
public BlockStateHolder getBlock() {
|
||||
return block;
|
||||
}
|
||||
|
||||
@ -54,13 +55,13 @@ public class BlockPattern extends AbstractPattern {
|
||||
*
|
||||
* @param block the block
|
||||
*/
|
||||
public void setBlock(BaseBlock block) {
|
||||
public void setBlock(BlockStateHolder block) {
|
||||
checkNotNull(block);
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBlock apply(Vector position) {
|
||||
public BlockStateHolder apply(Vector position) {
|
||||
return block;
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@ package com.sk89q.worldedit.function.pattern;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.type.BlockStateHolder;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
@ -45,7 +46,7 @@ public class ClipboardPattern extends AbstractPattern {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBlock apply(Vector position) {
|
||||
public BlockStateHolder apply(Vector position) {
|
||||
int xp = Math.abs(position.getBlockX()) % size.getBlockX();
|
||||
int yp = Math.abs(position.getBlockY()) % size.getBlockY();
|
||||
int zp = Math.abs(position.getBlockZ()) % size.getBlockZ();
|
||||
|
@ -21,18 +21,19 @@ package com.sk89q.worldedit.function.pattern;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.type.BlockStateHolder;
|
||||
|
||||
/**
|
||||
* Returns a {@link BaseBlock} for a given position.
|
||||
* Returns a {@link BlockStateHolder} for a given position.
|
||||
*/
|
||||
public interface Pattern {
|
||||
|
||||
/**
|
||||
* Return a {@link BaseBlock} for the given position.
|
||||
* Return a {@link BlockStateHolder} for the given position.
|
||||
*
|
||||
* @param position the position
|
||||
* @return a block
|
||||
*/
|
||||
BaseBlock apply(Vector position);
|
||||
BlockStateHolder apply(Vector position);
|
||||
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ package com.sk89q.worldedit.function.pattern;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.type.BlockStateHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -53,7 +54,7 @@ public class RandomPattern extends AbstractPattern {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBlock apply(Vector position) {
|
||||
public BlockStateHolder apply(Vector position) {
|
||||
double r = random.nextDouble();
|
||||
double offset = 0;
|
||||
|
||||
|
@ -21,6 +21,7 @@ package com.sk89q.worldedit.function.pattern;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.blocks.type.BlockStateHolder;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
@ -83,7 +84,7 @@ public class RepeatingExtentPattern extends AbstractPattern {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBlock apply(Vector position) {
|
||||
public BlockStateHolder apply(Vector position) {
|
||||
Vector base = position.add(offset);
|
||||
Vector size = extent.getMaximumPoint().subtract(extent.getMinimumPoint()).add(1, 1, 1);
|
||||
int x = base.getBlockX() % size.getBlockX();
|
||||
|
Reference in New Issue
Block a user