mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-11-16 17:16:11 +00:00
minor
idk it compiles now
This commit is contained in:
parent
3b879477b6
commit
7a57a5dd8c
@ -77,44 +77,44 @@ public class FaweAPI {
|
|||||||
return TaskManager.IMP;
|
return TaskManager.IMP;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Add a custom mask for use in e.g {@literal //mask #id:<input>}
|
// * Add a custom mask for use in e.g {@literal //mask #id:<input>}
|
||||||
*
|
// *
|
||||||
* @param methods The class with a bunch of mask methods
|
// * @param methods The class with a bunch of mask methods
|
||||||
* @return true if the mask was registered
|
// * @return true if the mask was registered
|
||||||
* @see com.sk89q.worldedit.command.MaskCommands
|
// * @see com.sk89q.worldedit.command.MaskCommands
|
||||||
*/
|
// */
|
||||||
public static boolean registerMasks(Object methods) {
|
// public static boolean registerMasks(Object methods) {
|
||||||
DefaultMaskParser parser = getParser(DefaultMaskParser.class);
|
// DefaultMaskParser parser = getParser(DefaultMaskParser.class);
|
||||||
if (parser != null) parser.register(methods);
|
// if (parser != null) parser.register(methods);
|
||||||
return parser != null;
|
// return parser != null;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* Add a custom material for use in e.g {@literal //material #id:<input>}
|
// * Add a custom material for use in e.g {@literal //material #id:<input>}
|
||||||
*
|
// *
|
||||||
* @param methods The class with a bunch of pattern methods
|
// * @param methods The class with a bunch of pattern methods
|
||||||
* @return true if the mask was registered
|
// * @return true if the mask was registered
|
||||||
* @see com.sk89q.worldedit.command.PatternCommands
|
// * @see com.sk89q.worldedit.command.PatternCommands
|
||||||
*/
|
// */
|
||||||
public static boolean registerPatterns(Object methods) {
|
// public static boolean registerPatterns(Object methods) {
|
||||||
DefaultPatternParser parser = getParser(DefaultPatternParser.class);
|
// DefaultPatternParser parser = getParser(DefaultPatternParser.class);
|
||||||
if (parser != null) parser.register(methods);
|
// if (parser != null) parser.register(methods);
|
||||||
return parser != null;
|
// return parser != null;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* Add a custom transform for use in
|
// * Add a custom transform for use in
|
||||||
*
|
// *
|
||||||
* @param methods The class with a bunch of transform methods
|
// * @param methods The class with a bunch of transform methods
|
||||||
* @return true if the transform was registered
|
// * @return true if the transform was registered
|
||||||
* @see com.sk89q.worldedit.command.TransformCommands
|
// * @see com.sk89q.worldedit.command.TransformCommands
|
||||||
*/
|
// */
|
||||||
public static boolean registerTransforms(Object methods) {
|
// public static boolean registerTransforms(Object methods) {
|
||||||
DefaultTransformParser parser = Fawe.get().getTransformParser();
|
// DefaultTransformParser parser = Fawe.get().getTransformParser();
|
||||||
if (parser != null) parser.register(methods);
|
// if (parser != null) parser.register(methods);
|
||||||
return parser != null;
|
// return parser != null;
|
||||||
}
|
// }
|
||||||
|
|
||||||
public static <T> T getParser(Class<T> parserClass) {
|
public static <T> T getParser(Class<T> parserClass) {
|
||||||
try {
|
try {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.boydti.fawe.beta;
|
package com.boydti.fawe.beta;
|
||||||
|
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
|
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.entity.BaseEntity;
|
import com.sk89q.worldedit.entity.BaseEntity;
|
||||||
import com.sk89q.worldedit.entity.Entity;
|
import com.sk89q.worldedit.entity.Entity;
|
||||||
@ -26,6 +27,8 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
|
|||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class DelegateFilterBlock extends FilterBlock {
|
public class DelegateFilterBlock extends FilterBlock {
|
||||||
@ -413,6 +416,26 @@ public class DelegateFilterBlock extends FilterBlock {
|
|||||||
return parent.divide(n);
|
return parent.divide(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockVector3 shr(int x, int y, int z) {
|
||||||
|
return parent.shr(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockVector3 shr(int n) {
|
||||||
|
return parent.shr(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockVector3 shl(int x, int y, int z) {
|
||||||
|
return parent.shl(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockVector3 shl(int n) {
|
||||||
|
return parent.shl(n);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double length() {
|
public double length() {
|
||||||
return parent.length();
|
return parent.length();
|
||||||
@ -519,6 +542,11 @@ public class DelegateFilterBlock extends FilterBlock {
|
|||||||
return parent.toVector3();
|
return parent.toVector3();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
return parent.equals(obj);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return parent.hashCode();
|
return parent.hashCode();
|
||||||
@ -545,6 +573,37 @@ public class DelegateFilterBlock extends FilterBlock {
|
|||||||
return parent.createEntity(location, entity);
|
return parent.createEntity(location, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Nullable
|
||||||
|
public void removeEntity(int x, int y, int z, UUID uuid) {
|
||||||
|
parent.removeEntity(x, y, z, uuid);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isQueueEnabled() {
|
||||||
|
return parent.isQueueEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void enableQueue() {
|
||||||
|
parent.enableQueue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disableQueue() {
|
||||||
|
parent.disableQueue();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isWorld() {
|
||||||
|
return parent.isWorld();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean regenerateChunk(int x, int z, @Nullable BiomeType type, @Nullable Long seed) {
|
||||||
|
return parent.regenerateChunk(x, z, type, seed);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getHighestTerrainBlock(int x, int z, int minY, int maxY) {
|
public int getHighestTerrainBlock(int x, int z, int minY, int maxY) {
|
||||||
return parent.getHighestTerrainBlock(x, z, minY, maxY);
|
return parent.getHighestTerrainBlock(x, z, minY, maxY);
|
||||||
@ -644,12 +703,62 @@ public class DelegateFilterBlock extends FilterBlock {
|
|||||||
return parent.lazyCopy(region);
|
return parent.lazyCopy(region);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int countBlocks(Region region, Set<BaseBlock> searchBlocks) {
|
||||||
|
return parent.countBlocks(region, searchBlocks);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int countBlocks(Region region, Mask searchMask) {
|
||||||
|
return parent.countBlocks(region, searchMask);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <B extends BlockStateHolder<B>> int setBlocks(Region region, B block) throws MaxChangedBlocksException {
|
||||||
|
return parent.setBlocks(region, block);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int setBlocks(Region region, Pattern pattern) throws MaxChangedBlocksException {
|
||||||
|
return parent.setBlocks(region, pattern);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <B extends BlockStateHolder<B>> int replaceBlocks(Region region, Set<BaseBlock> filter, B replacement) throws MaxChangedBlocksException {
|
||||||
|
return parent.replaceBlocks(region, filter, replacement);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int replaceBlocks(Region region, Set<BaseBlock> filter, Pattern pattern) throws MaxChangedBlocksException {
|
||||||
|
return parent.replaceBlocks(region, filter, pattern);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int replaceBlocks(Region region, Mask mask, Pattern pattern) throws MaxChangedBlocksException {
|
||||||
|
return parent.replaceBlocks(region, mask, pattern);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int center(Region region, Pattern pattern) throws MaxChangedBlocksException {
|
||||||
|
return parent.center(region, pattern);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int setBlocks(Set<BlockVector3> vset, Pattern pattern) {
|
||||||
|
return parent.setBlocks(vset, pattern);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Nullable
|
@Nullable
|
||||||
public Operation commit() {
|
public Operation commit() {
|
||||||
return parent.commit();
|
return parent.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean cancel() {
|
||||||
|
return parent.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxY() {
|
public int getMaxY() {
|
||||||
return parent.getMaxY();
|
return parent.getMaxY();
|
||||||
@ -660,11 +769,6 @@ public class DelegateFilterBlock extends FilterBlock {
|
|||||||
return parent.getBlock(position);
|
return parent.getBlock(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public BlockType getBlockType(BlockVector3 position) {
|
|
||||||
return parent.getBlockType(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseBlock getFullBlock(BlockVector3 position) {
|
public BaseBlock getFullBlock(BlockVector3 position) {
|
||||||
return parent.getFullBlock(position);
|
return parent.getFullBlock(position);
|
||||||
@ -680,6 +784,7 @@ public class DelegateFilterBlock extends FilterBlock {
|
|||||||
return parent.getBiomeType(x, z);
|
return parent.getBiomeType(x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 position, T block)
|
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 position, T block)
|
||||||
throws WorldEditException {
|
throws WorldEditException {
|
||||||
@ -692,6 +797,11 @@ public class DelegateFilterBlock extends FilterBlock {
|
|||||||
return parent.setBlock(x, y, z, block);
|
return parent.setBlock(x, y, z, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setTile(int x, int y, int z, CompoundTag tile) throws WorldEditException {
|
||||||
|
return parent.setTile(x, y, z, tile);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
||||||
return parent.setBiome(position, biome);
|
return parent.setBiome(position, biome);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.boydti.fawe.beta;
|
package com.boydti.fawe.beta;
|
||||||
|
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.blocks.TileEntityBlock;
|
import com.sk89q.worldedit.blocks.TileEntityBlock;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
@ -55,6 +56,12 @@ public abstract class FilterBlock extends BlockVector3 implements Extent, TileEn
|
|||||||
return getExtent().getBlock(x, y, z);
|
return getExtent().getBlock(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setTile(int x, int y, int z, CompoundTag tile) throws WorldEditException {
|
||||||
|
return getExtent().setTile(x, y, z, tile);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseBlock getFullBlock(int x, int y, int z) {
|
public BaseBlock getFullBlock(int x, int y, int z) {
|
||||||
return getExtent().getFullBlock(x, y, z);
|
return getExtent().getFullBlock(x, y, z);
|
||||||
|
@ -24,7 +24,7 @@ public interface IChunkSet extends IBlocks, OutputExtent {
|
|||||||
|
|
||||||
boolean isEmpty();
|
boolean isEmpty();
|
||||||
|
|
||||||
void setTile(int x, int y, int z, CompoundTag tile);
|
boolean setTile(int x, int y, int z, CompoundTag tile);
|
||||||
|
|
||||||
void setEntity(CompoundTag tag);
|
void setEntity(CompoundTag tag);
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import com.boydti.fawe.beta.implementation.WorldChunkCache;
|
|||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
|
import com.sk89q.worldedit.registry.Keyed;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
@ -17,7 +18,7 @@ import java.util.function.Supplier;
|
|||||||
* TODO: implement Extent (need to refactor Extent first) Interface for a queue based extent which
|
* TODO: implement Extent (need to refactor Extent first) Interface for a queue based extent which
|
||||||
* uses chunks
|
* uses chunks
|
||||||
*/
|
*/
|
||||||
public interface IQueueExtent extends Flushable, Trimable, Extent {
|
public interface IQueueExtent extends Flushable, Trimable, Extent, Keyed {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default boolean isQueueEnabled() {
|
default boolean isQueueEnabled() {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.boydti.fawe.beta;
|
package com.boydti.fawe.beta;
|
||||||
|
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.extent.Extent;
|
import com.sk89q.worldedit.extent.Extent;
|
||||||
import com.sk89q.worldedit.math.BlockVector3;
|
import com.sk89q.worldedit.math.BlockVector3;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
|
@ -34,8 +34,8 @@ public interface DelegateChunkSet extends IChunkSet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default void setTile(int x, int y, int z, CompoundTag tile) {
|
default boolean setTile(int x, int y, int z, CompoundTag tile) {
|
||||||
getParent().setTile(x, y, z, tile);
|
return getParent().setTile(x, y, z, tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -7,6 +7,8 @@ import com.sk89q.jnbt.CompoundTag;
|
|||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -39,7 +41,8 @@ public class BitSetBlocks implements IChunkSet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTile(int x, int y, int z, CompoundTag tile) {
|
public boolean setTile(int x, int y, int z, CompoundTag tile) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -61,8 +64,33 @@ public class BitSetBlocks implements IChunkSet {
|
|||||||
@Override
|
@Override
|
||||||
public char[] getArray(int layer) {
|
public char[] getArray(int layer) {
|
||||||
char[] arr = FaweCache.SECTION_BITS_TO_CHAR.get();
|
char[] arr = FaweCache.SECTION_BITS_TO_CHAR.get();
|
||||||
|
MemBlockSet.IRow nullRowY = row.getRow(layer);
|
||||||
|
if (nullRowY instanceof MemBlockSet.RowY) {
|
||||||
|
char value = blockState.getOrdinalChar();
|
||||||
|
MemBlockSet.RowY rowY = (MemBlockSet.RowY) nullRowY;
|
||||||
|
long[] bits = rowY.getBits();
|
||||||
|
for (int y = 0, longIndex = 0, blockIndex = 0; y < 16; y++) {
|
||||||
|
for (int z = 0; z < 16; z += 4, longIndex++, blockIndex += 64) {
|
||||||
|
long bitBuffer = bits[longIndex];
|
||||||
|
if (bitBuffer != 0) {
|
||||||
|
if (bitBuffer == -1L) {
|
||||||
|
Arrays.fill(arr, blockIndex, blockIndex + 64, value);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Arrays.fill(arr, Character.MIN_VALUE);
|
||||||
|
do {
|
||||||
|
final long lowBit = Long.lowestOneBit(bitBuffer);
|
||||||
|
final int bitIndex = Long.bitCount(lowBit - 1);
|
||||||
|
arr[blockIndex + bitIndex] = value;
|
||||||
|
bitBuffer = bitBuffer ^ lowBit;
|
||||||
|
} while (bitBuffer != 0);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return arr;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BiomeType[] getBiomes() {
|
public BiomeType[] getBiomes() {
|
||||||
|
@ -77,12 +77,13 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setTile(int x, int y, int z, CompoundTag tile) {
|
public boolean setTile(int x, int y, int z, CompoundTag tile) {
|
||||||
if (tiles == null) {
|
if (tiles == null) {
|
||||||
tiles = new HashMap<>();
|
tiles = new HashMap<>();
|
||||||
}
|
}
|
||||||
final short pair = MathMan.tripleBlockCoord(x, y, z);
|
final short pair = MathMan.tripleBlockCoord(x, y, z);
|
||||||
tiles.put(pair, tile);
|
tiles.put(pair, tile);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,47 +0,0 @@
|
|||||||
package com.boydti.fawe.object.brush.visualization;
|
|
||||||
|
|
||||||
import com.boydti.fawe.beta.IChunk;
|
|
||||||
import com.boydti.fawe.beta.IChunkGet;
|
|
||||||
import com.boydti.fawe.beta.IChunkSet;
|
|
||||||
import com.boydti.fawe.beta.implementation.blocks.BitSetBlocks;
|
|
||||||
import com.boydti.fawe.beta.implementation.holder.ChunkHolder;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
|
||||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
|
||||||
|
|
||||||
import java.util.concurrent.Future;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* FAWE visualizations display glass (20) as a placeholder
|
|
||||||
* - Using a non transparent block can cause FPS lag
|
|
||||||
*/
|
|
||||||
public class VisualChunk extends ChunkHolder {
|
|
||||||
private final IChunk parent;
|
|
||||||
private final VisualExtent extent;
|
|
||||||
|
|
||||||
public VisualChunk(IChunk parent, VisualExtent extent) {
|
|
||||||
this.parent = parent;
|
|
||||||
this.extent = extent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IChunk getParent() {
|
|
||||||
return parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Future call() {
|
|
||||||
return extent.sendChunkUpdate(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IChunkGet get() {
|
|
||||||
if (parent instanceof ChunkHolder) {
|
|
||||||
return ((ChunkHolder) parent).get();
|
|
||||||
}
|
|
||||||
return parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IChunkSet createSet() {
|
|
||||||
return new BitSetBlocks(VISUALIZE_BLOCK);
|
|
||||||
}
|
|
||||||
}
|
|
@ -29,11 +29,11 @@ public class VisualExtent extends AbstractDelegateExtent {
|
|||||||
private final BlockType visualizeBlock;
|
private final BlockType visualizeBlock;
|
||||||
private final Player player;
|
private final Player player;
|
||||||
|
|
||||||
public VisualExtent(IQueueExtent parent, Player player) {
|
public VisualExtent(Extent parent, Player player) {
|
||||||
this(parent, player, VISUALIZE_BLOCK_DEFAULT);
|
this(parent, player, VISUALIZE_BLOCK_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public VisualExtent(IQueueExtent parent, Player player, BlockType visualizeBlock) {
|
public VisualExtent(Extent parent, Player player, BlockType visualizeBlock) {
|
||||||
super(parent);
|
super(parent);
|
||||||
this.visualizeBlock = visualizeBlock;
|
this.visualizeBlock = visualizeBlock;
|
||||||
this.player = player;
|
this.player = player;
|
||||||
|
@ -22,6 +22,7 @@ import com.boydti.fawe.util.ReflectionUtils;
|
|||||||
import com.boydti.fawe.util.TextureUtil;
|
import com.boydti.fawe.util.TextureUtil;
|
||||||
import com.boydti.fawe.util.image.Drawable;
|
import com.boydti.fawe.util.image.Drawable;
|
||||||
import com.boydti.fawe.util.image.ImageViewer;
|
import com.boydti.fawe.util.image.ImageViewer;
|
||||||
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
@ -1929,6 +1930,11 @@ public class HeightMapMCAGenerator extends MCAWriter implements StreamChange, Dr
|
|||||||
}
|
}
|
||||||
|
|
||||||
// These aren't implemented yet...
|
// These aren't implemented yet...
|
||||||
|
@Override
|
||||||
|
public boolean setTile(int x, int y, int z, CompoundTag tile) throws WorldEditException {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getBlockLightLevel(BlockVector3 position) {
|
public int getBlockLightLevel(BlockVector3 position) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -4,6 +4,7 @@ import com.boydti.fawe.object.FawePlayer;
|
|||||||
import com.boydti.fawe.beta.IQueueExtent;
|
import com.boydti.fawe.beta.IQueueExtent;
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
|
import com.sk89q.worldedit.regions.Region;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
import com.sk89q.worldedit.extent.inventory.BlockBag;
|
||||||
@ -17,10 +18,16 @@ import com.sk89q.worldedit.world.biome.BiomeType;
|
|||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
public class AbstractDelegateChangeSet extends FaweChangeSet {
|
public class AbstractDelegateChangeSet extends FaweChangeSet {
|
||||||
public final FaweChangeSet parent;
|
public final FaweChangeSet parent;
|
||||||
|
|
||||||
|
public static FaweChangeSet getDefaultChangeSet(World world, UUID uuid) {
|
||||||
|
return FaweChangeSet.getDefaultChangeSet(world, uuid);
|
||||||
|
}
|
||||||
|
|
||||||
public AbstractDelegateChangeSet(FaweChangeSet parent) {
|
public AbstractDelegateChangeSet(FaweChangeSet parent) {
|
||||||
super(parent.getWorld());
|
super(parent.getWorld());
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
@ -28,11 +35,6 @@ public class AbstractDelegateChangeSet extends FaweChangeSet {
|
|||||||
this.waitingAsync = parent.waitingAsync;
|
this.waitingAsync = parent.waitingAsync;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addChangeTask(IQueueExtent queue) {
|
|
||||||
super.addChangeTask(queue);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean flush() {
|
public boolean flush() {
|
||||||
return parent.flush();
|
return parent.flush();
|
||||||
@ -63,6 +65,11 @@ public class AbstractDelegateChangeSet extends FaweChangeSet {
|
|||||||
return parent.flushAsync();
|
return parent.flushAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean closeAsync() {
|
||||||
|
return parent.closeAsync();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(int x, int y, int z, int combinedFrom, int combinedTo) {
|
public void add(int x, int y, int z, int combinedFrom, int combinedTo) {
|
||||||
parent.add(x, y, z, combinedFrom, combinedTo);
|
parent.add(x, y, z, combinedFrom, combinedTo);
|
||||||
@ -128,6 +135,11 @@ public class AbstractDelegateChangeSet extends FaweChangeSet {
|
|||||||
return parent.toEditSession(player);
|
return parent.toEditSession(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EditSession toEditSession(FawePlayer player, Region[] regions) {
|
||||||
|
return parent.toEditSession(player, regions);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void add(EntityCreate change) {
|
public void add(EntityCreate change) {
|
||||||
parent.add(change);
|
parent.add(change);
|
||||||
@ -168,15 +180,23 @@ public class AbstractDelegateChangeSet extends FaweChangeSet {
|
|||||||
parent.add(x, y, z, combinedFrom, to);
|
parent.add(x, y, z, combinedFrom, to);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Future<?> addWriteTask(Runnable writeTask) {
|
||||||
|
return parent.addWriteTask(writeTask);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Future<?> addWriteTask(Runnable writeTask, boolean completeNow) {
|
||||||
|
return parent.addWriteTask(writeTask, completeNow);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isRecordingChanges() {
|
public boolean isRecordingChanges() {
|
||||||
// TODO Auto-generated method stub
|
return parent.isRecordingChanges();
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRecordChanges(boolean recordChanges) {
|
public void setRecordChanges(boolean recordChanges) {
|
||||||
// TODO Auto-generated method stub
|
parent.setRecordChanges(recordChanges);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,116 +0,0 @@
|
|||||||
package com.boydti.fawe.object.changeset;
|
|
||||||
|
|
||||||
import com.boydti.fawe.Fawe;
|
|
||||||
import com.boydti.fawe.config.Settings;
|
|
||||||
import com.boydti.fawe.util.MainUtil;
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.common.collect.Iterators;
|
|
||||||
import com.sk89q.jnbt.CompoundTag;
|
|
||||||
import com.sk89q.worldedit.history.change.Change;
|
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.nio.file.StandardCopyOption;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
public class AnvilHistory extends FaweChangeSet {
|
|
||||||
private final File folder;
|
|
||||||
private int size;
|
|
||||||
|
|
||||||
public AnvilHistory(String world, File folder) {
|
|
||||||
super(world);
|
|
||||||
this.folder = folder;
|
|
||||||
size = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AnvilHistory(String world, UUID uuid) {
|
|
||||||
super(world);
|
|
||||||
File history = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HISTORY + File.separator + world + File.separator + uuid);
|
|
||||||
File destFolder = new File(history, Integer.toString(MainUtil.getMaxFileId(history)));
|
|
||||||
if (!destFolder.exists()) {
|
|
||||||
destFolder.mkdirs();
|
|
||||||
}
|
|
||||||
this.folder = destFolder;
|
|
||||||
this.size = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//@Override
|
|
||||||
public boolean addFileChange(File originalMCAFile) {
|
|
||||||
try {
|
|
||||||
Files.move(originalMCAFile.toPath(), Paths.get(folder.getPath(), originalMCAFile.getName()), StandardCopyOption.ATOMIC_MOVE);
|
|
||||||
if (size != -1) size++;
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
originalMCAFile.delete();
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void add(int x, int y, int z, int combinedFrom, int combinedTo) {
|
|
||||||
throw new UnsupportedOperationException("Only anvil operations are supported");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTileCreate(CompoundTag tag) {
|
|
||||||
throw new UnsupportedOperationException("Only anvil operations are supported");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addTileRemove(CompoundTag tag) {
|
|
||||||
throw new UnsupportedOperationException("Only anvil operations are supported");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addEntityRemove(CompoundTag tag) {
|
|
||||||
throw new UnsupportedOperationException("Only anvil operations are supported");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addEntityCreate(CompoundTag tag) {
|
|
||||||
throw new UnsupportedOperationException("Only anvil operations are supported");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addBiomeChange(int x, int z, BiomeType from, BiomeType to) {
|
|
||||||
throw new UnsupportedOperationException("Only anvil operations are supported");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Iterator<Change> getIterator(boolean redo) {
|
|
||||||
if (redo) throw new UnsupportedOperationException("Only undo operations are supported");
|
|
||||||
List<File> files = Arrays.asList(folder.listFiles());
|
|
||||||
final MutableAnvilChange change = new MutableAnvilChange();
|
|
||||||
return Iterators.transform(files.iterator(), new Function<File, MutableAnvilChange>() {
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public MutableAnvilChange apply(@Nullable File input) {
|
|
||||||
change.setSource(input.toPath());
|
|
||||||
return change;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int size() {
|
|
||||||
return size == -1 ? folder.listFiles().length : size;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isRecordingChanges() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setRecordChanges(boolean recordChanges) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -20,7 +20,7 @@ public class CFIChangeSet extends FaweChangeSet {
|
|||||||
|
|
||||||
public CFIChangeSet(HeightMapMCAGenerator hmmg, UUID uuid) throws IOException {
|
public CFIChangeSet(HeightMapMCAGenerator hmmg, UUID uuid) throws IOException {
|
||||||
super(hmmg);
|
super(hmmg);
|
||||||
File folder = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HISTORY + File.separator + uuid + File.separator + "CFI" + File.separator + hmmg.getWorldName());
|
File folder = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HISTORY + File.separator + uuid + File.separator + "CFI" + File.separator + hmmg.getId());
|
||||||
int max = MainUtil.getMaxFileId(folder);
|
int max = MainUtil.getMaxFileId(folder);
|
||||||
this.file = new File(folder, max + ".cfi");
|
this.file = new File(folder, max + ".cfi");
|
||||||
File parent = this.file.getParentFile();
|
File parent = this.file.getParentFile();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.boydti.fawe.object.clipboard;
|
package com.boydti.fawe.object.clipboard;
|
||||||
|
|
||||||
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
import com.sk89q.worldedit.math.BlockVector2;
|
import com.sk89q.worldedit.math.BlockVector2;
|
||||||
@ -68,6 +69,11 @@ public class EmptyClipboard implements Clipboard {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setTile(int x, int y, int z, CompoundTag tile) throws WorldEditException {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -827,6 +827,10 @@ public final class MemBlockSet extends BlockSet {
|
|||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IRow getRow(int i) {
|
||||||
|
return rows[i];
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean get(IRow[] parent, int x, int y, int z) {
|
public boolean get(IRow[] parent, int x, int y, int z) {
|
||||||
return rows[y >> 4].get(this.rows, x, y, z);
|
return rows[y >> 4].get(this.rows, x, y, z);
|
||||||
@ -873,6 +877,10 @@ public final class MemBlockSet extends BlockSet {
|
|||||||
this.bits = new long[WORDS];
|
this.bits = new long[WORDS];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long[] getBits() {
|
||||||
|
return bits;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean get(IRow[] parent, int x, int y, int z) {
|
public boolean get(IRow[] parent, int x, int y, int z) {
|
||||||
int i = ((y & 15) << 8) | ((z & 15) << 4) | (x & 15);
|
int i = ((y & 15) << 8) | ((z & 15) << 4) | (x & 15);
|
||||||
|
@ -254,11 +254,6 @@ public class NullExtent extends FaweRegionExtent {
|
|||||||
throw reason;
|
throw reason;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public World getWorld() {
|
|
||||||
throw reason;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getNearestSurfaceLayer(int x, int z, int y, int minY, int maxY) {
|
public int getNearestSurfaceLayer(int x, int z, int y, int minY, int maxY) {
|
||||||
throw reason;
|
throw reason;
|
||||||
|
@ -104,7 +104,7 @@ public class FaweLocalBlockQueue extends LocalBlockQueue {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getWorld() {
|
public String getWorld() {
|
||||||
return IMP.getWorld().getName();
|
return IMP.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -40,11 +40,12 @@ public class FaweTrim extends SubCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
PlotTrim trim = new PlotTrim(plotPlayer, plotPlayer.getPlotAreaAbs(), strings[0], Boolean.parseBoolean(strings[1]));
|
// TODO NOT IMPLEMENTED
|
||||||
Location loc = plotPlayer.getLocation();
|
// PlotTrim trim = new PlotTrim(plotPlayer, plotPlayer.getPlotAreaAbs(), strings[0], Boolean.parseBoolean(strings[1]));
|
||||||
trim.setChunk(loc.getX() >> 4, loc.getZ() >> 4);
|
// Location loc = plotPlayer.getLocation();
|
||||||
trim.run();
|
// trim.setChunk(loc.getX() >> 4, loc.getZ() >> 4);
|
||||||
plotPlayer.sendMessage("Done!");
|
// trim.run();
|
||||||
|
// plotPlayer.sendMessage("Done!");
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -165,49 +165,4 @@ public class WEManager {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean delay(FawePlayer<?> player, String command) {
|
|
||||||
final long start = System.currentTimeMillis();
|
|
||||||
return this.delay(player, () -> {
|
|
||||||
try {
|
|
||||||
if (System.currentTimeMillis() - start > 1000) {
|
|
||||||
BBC.WORLDEDIT_RUN.send(FawePlayer.wrap(player));
|
|
||||||
}
|
|
||||||
TaskManager.IMP.task(() -> {
|
|
||||||
final long start1 = System.currentTimeMillis();
|
|
||||||
player.executeCommand(command.substring(1));
|
|
||||||
TaskManager.IMP.later(() -> SetQueue.IMP.addEmptyTask(() -> {
|
|
||||||
if (System.currentTimeMillis() - start1 > 1000) {
|
|
||||||
BBC.WORLDEDIT_COMPLETE.send(FawePlayer.wrap(player));
|
|
||||||
}
|
|
||||||
}), 2);
|
|
||||||
});
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}, false, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean delay(FawePlayer<?> player, Runnable whenDone, boolean delayed, boolean onlyDelayedExecution) {
|
|
||||||
final boolean free = SetQueue.IMP.addEmptyTask(null);
|
|
||||||
if (free) {
|
|
||||||
if (delayed) {
|
|
||||||
if (whenDone != null) {
|
|
||||||
whenDone.run();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (whenDone != null && !onlyDelayedExecution) {
|
|
||||||
whenDone.run();
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!delayed && player != null) {
|
|
||||||
BBC.WORLDEDIT_DELAYED.send(player);
|
|
||||||
}
|
|
||||||
SetQueue.IMP.addEmptyTask(whenDone);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package com.boydti.fawe.wrappers;
|
|||||||
import com.boydti.fawe.object.RunnableVal;
|
import com.boydti.fawe.object.RunnableVal;
|
||||||
import com.boydti.fawe.util.TaskManager;
|
import com.boydti.fawe.util.TaskManager;
|
||||||
|
|
||||||
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
@ -74,6 +75,11 @@ public class WorldWrapper extends AbstractWorld {
|
|||||||
return parent.setBlock(position, block, notifyAndLight);
|
return parent.setBlock(position, block, notifyAndLight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setTile(int x, int y, int z, CompoundTag tile) throws WorldEditException {
|
||||||
|
return parent.setTile(x, y, z, tile);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxY() {
|
public int getMaxY() {
|
||||||
return parent.getMaxY();
|
return parent.getMaxY();
|
||||||
|
@ -28,7 +28,6 @@ import com.boydti.fawe.object.FaweLimit;
|
|||||||
import com.boydti.fawe.object.FaweOutputStream;
|
import com.boydti.fawe.object.FaweOutputStream;
|
||||||
import com.boydti.fawe.object.FawePlayer;
|
import com.boydti.fawe.object.FawePlayer;
|
||||||
import com.boydti.fawe.object.brush.visualization.VirtualWorld;
|
import com.boydti.fawe.object.brush.visualization.VirtualWorld;
|
||||||
import com.boydti.fawe.object.changeset.AnvilHistory;
|
|
||||||
import com.boydti.fawe.object.changeset.DiskStorageHistory;
|
import com.boydti.fawe.object.changeset.DiskStorageHistory;
|
||||||
import com.boydti.fawe.object.changeset.FaweChangeSet;
|
import com.boydti.fawe.object.changeset.FaweChangeSet;
|
||||||
import com.boydti.fawe.object.clipboard.MultiClipboardHolder;
|
import com.boydti.fawe.object.clipboard.MultiClipboardHolder;
|
||||||
@ -387,7 +386,8 @@ public class LocalSession implements TextureHolder {
|
|||||||
File folder = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HISTORY + File.separator + currentWorld.getName() + File.separator + uuid);
|
File folder = MainUtil.getFile(Fawe.imp().getDirectory(), Settings.IMP.PATHS.HISTORY + File.separator + currentWorld.getName() + File.separator + uuid);
|
||||||
File specific = new File(folder, o.toString());
|
File specific = new File(folder, o.toString());
|
||||||
if (specific.isDirectory()) {
|
if (specific.isDirectory()) {
|
||||||
return new AnvilHistory(currentWorld.getName(), specific);
|
// TODO NOT IMPLEMENTED
|
||||||
|
// return new AnvilHistory(currentWorld.getName(), specific);
|
||||||
} else {
|
} else {
|
||||||
return new DiskStorageHistory(currentWorld, this.uuid, (Integer) o);
|
return new DiskStorageHistory(currentWorld, this.uuid, (Integer) o);
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,8 @@ import com.sk89q.worldedit.function.factory.Apply;
|
|||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.internal.annotation.Direction;
|
import com.sk89q.worldedit.internal.annotation.Direction;
|
||||||
import com.sk89q.worldedit.internal.command.CommandRegistrationHandler;
|
import com.sk89q.worldedit.internal.command.CommandRegistrationHandler;
|
||||||
|
import com.sk89q.worldedit.internal.expression.Expression;
|
||||||
|
import com.sk89q.worldedit.internal.expression.runtime.Constant;
|
||||||
import com.sk89q.worldedit.regions.factory.RegionFactory;
|
import com.sk89q.worldedit.regions.factory.RegionFactory;
|
||||||
import com.sk89q.worldedit.util.TreeGenerator;
|
import com.sk89q.worldedit.util.TreeGenerator;
|
||||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||||
@ -96,7 +98,7 @@ public class ApplyBrushCommands {
|
|||||||
Contextual<? extends RegionFunction> generatorFactory) throws WorldEditException {
|
Contextual<? extends RegionFunction> generatorFactory) throws WorldEditException {
|
||||||
double radius = requireNonNull(RADIUS.value(parameters).asSingle(double.class));
|
double radius = requireNonNull(RADIUS.value(parameters).asSingle(double.class));
|
||||||
RegionFactory regionFactory = REGION_FACTORY.value(parameters).asSingle(RegionFactory.class);
|
RegionFactory regionFactory = REGION_FACTORY.value(parameters).asSingle(RegionFactory.class);
|
||||||
BrushCommands.setOperationBasedBrush(player, localSession, radius,
|
BrushCommands.setOperationBasedBrush(player, localSession, new Expression(radius),
|
||||||
new Apply(generatorFactory), regionFactory, "worldedit.brush.apply");
|
new Apply(generatorFactory), regionFactory, "worldedit.brush.apply");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +37,7 @@ import com.sk89q.worldedit.function.factory.Paint;
|
|||||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||||
import com.sk89q.worldedit.internal.annotation.Direction;
|
import com.sk89q.worldedit.internal.annotation.Direction;
|
||||||
import com.sk89q.worldedit.internal.command.CommandRegistrationHandler;
|
import com.sk89q.worldedit.internal.command.CommandRegistrationHandler;
|
||||||
|
import com.sk89q.worldedit.internal.expression.Expression;
|
||||||
import com.sk89q.worldedit.regions.factory.RegionFactory;
|
import com.sk89q.worldedit.regions.factory.RegionFactory;
|
||||||
import com.sk89q.worldedit.util.TreeGenerator;
|
import com.sk89q.worldedit.util.TreeGenerator;
|
||||||
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
import com.sk89q.worldedit.util.formatting.text.TextComponent;
|
||||||
@ -103,7 +104,7 @@ public class PaintBrushCommands {
|
|||||||
double radius = requireNonNull(RADIUS.value(parameters).asSingle(double.class));
|
double radius = requireNonNull(RADIUS.value(parameters).asSingle(double.class));
|
||||||
double density = requireNonNull(DENSITY.value(parameters).asSingle(double.class)) / 100;
|
double density = requireNonNull(DENSITY.value(parameters).asSingle(double.class)) / 100;
|
||||||
RegionFactory regionFactory = REGION_FACTORY.value(parameters).asSingle(RegionFactory.class);
|
RegionFactory regionFactory = REGION_FACTORY.value(parameters).asSingle(RegionFactory.class);
|
||||||
BrushCommands.setOperationBasedBrush(player, localSession, radius,
|
BrushCommands.setOperationBasedBrush(player, localSession, new Expression(radius),
|
||||||
new Paint(generatorFactory, density), regionFactory, "worldedit.brush.paint");
|
new Paint(generatorFactory, density), regionFactory, "worldedit.brush.paint");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ import com.sk89q.worldedit.command.util.CommandPermissions;
|
|||||||
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
import com.sk89q.worldedit.command.util.CommandPermissionsConditionGenerator;
|
||||||
import com.sk89q.worldedit.command.util.WorldEditAsyncCommandBuilder;
|
import com.sk89q.worldedit.command.util.WorldEditAsyncCommandBuilder;
|
||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.event.extent.PlayerSaveClipboardEvent;
|
import com.sk89q.worldedit.event.extent.ActorSaveClipboardEvent;
|
||||||
import com.sk89q.worldedit.extension.platform.Actor;
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
@ -698,7 +698,7 @@ public class SchematicCommands {
|
|||||||
if (holder instanceof URIClipboardHolder) {
|
if (holder instanceof URIClipboardHolder) {
|
||||||
uri = ((URIClipboardHolder) holder).getURI(clipboard);
|
uri = ((URIClipboardHolder) holder).getURI(clipboard);
|
||||||
}
|
}
|
||||||
if (new PlayerSaveClipboardEvent(player, clipboard, uri, file.toURI()).call()) {
|
if (new ActorSaveClipboardEvent(actor, clipboard, uri, file.toURI()).call()) {
|
||||||
if (writer instanceof MinecraftStructure) {
|
if (writer instanceof MinecraftStructure) {
|
||||||
((MinecraftStructure) writer).write(target, actor.getName());
|
((MinecraftStructure) writer).write(target, actor.getName());
|
||||||
} else {
|
} else {
|
||||||
|
@ -31,7 +31,6 @@ import com.boydti.fawe.object.brush.ResettableTool;
|
|||||||
import com.boydti.fawe.object.brush.TargetMode;
|
import com.boydti.fawe.object.brush.TargetMode;
|
||||||
import com.boydti.fawe.object.brush.scroll.ScrollAction;
|
import com.boydti.fawe.object.brush.scroll.ScrollAction;
|
||||||
import com.boydti.fawe.object.brush.scroll.ScrollTool;
|
import com.boydti.fawe.object.brush.scroll.ScrollTool;
|
||||||
import com.boydti.fawe.object.brush.visualization.VisualChunk;
|
|
||||||
import com.boydti.fawe.object.brush.visualization.VisualExtent;
|
import com.boydti.fawe.object.brush.visualization.VisualExtent;
|
||||||
import com.boydti.fawe.object.brush.visualization.VisualMode;
|
import com.boydti.fawe.object.brush.visualization.VisualMode;
|
||||||
import com.boydti.fawe.object.extent.ResettableExtent;
|
import com.boydti.fawe.object.extent.ResettableExtent;
|
||||||
@ -48,7 +47,6 @@ import com.sk89q.minecraft.util.commands.CommandException;
|
|||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.LocalConfiguration;
|
import com.sk89q.worldedit.LocalConfiguration;
|
||||||
import com.sk89q.worldedit.LocalSession;
|
import com.sk89q.worldedit.LocalSession;
|
||||||
import com.sk89q.worldedit.MaxBrushRadiusException;
|
|
||||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||||
import com.sk89q.worldedit.WorldEdit;
|
import com.sk89q.worldedit.WorldEdit;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
@ -669,17 +667,17 @@ public class BrushTool implements DoubleActionTraceTool, ScrollTool, MovableTool
|
|||||||
}
|
}
|
||||||
if (visualExtent != null) {
|
if (visualExtent != null) {
|
||||||
// clear old data
|
// clear old data
|
||||||
visualExtent.clear(newVisualExtent, player);
|
visualExtent.clear();
|
||||||
}
|
}
|
||||||
visualExtent = newVisualExtent;
|
visualExtent = newVisualExtent;
|
||||||
newVisualExtent.visualize(fp);
|
newVisualExtent.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clear(Player player) {
|
public void clear(Player player) {
|
||||||
FawePlayer<Object> fp = FawePlayer.wrap(player);
|
FawePlayer<Object> fp = FawePlayer.wrap(player);
|
||||||
Fawe.get().getVisualQueue().dequeue(fp);
|
Fawe.get().getVisualQueue().dequeue(fp);
|
||||||
if (visualExtent != null) {
|
if (visualExtent != null) {
|
||||||
visualExtent.clear(null, fp);
|
visualExtent.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,11 +49,12 @@ public final class SuggestionHelper {
|
|||||||
|
|
||||||
public static Stream<String> getBlockCategorySuggestions(String tag, boolean allowRandom) {
|
public static Stream<String> getBlockCategorySuggestions(String tag, boolean allowRandom) {
|
||||||
if (tag.isEmpty() || tag.equals("#")) {
|
if (tag.isEmpty() || tag.equals("#")) {
|
||||||
return Stream.of("##", "##*");
|
return allowRandom ? Stream.of("##", "##*") : Stream.of("##");
|
||||||
}
|
}
|
||||||
if (tag.startsWith("#")) {
|
if (tag.startsWith("##")) {
|
||||||
if (tag.equals("##")) {
|
if (tag.equals("##")) {
|
||||||
return Stream.concat(Stream.of("##*"), getNamespacedRegistrySuggestions(BlockCategory.REGISTRY, tag.substring(2)).map(s -> "##" + s));
|
return Stream.concat(allowRandom ? Stream.of("##*") : Stream.empty(),
|
||||||
|
getNamespacedRegistrySuggestions(BlockCategory.REGISTRY, tag.substring(2)).map(s -> "##" + s));
|
||||||
} else if (tag.equals("##*") && allowRandom) {
|
} else if (tag.equals("##*") && allowRandom) {
|
||||||
return getNamespacedRegistrySuggestions(BlockCategory.REGISTRY, tag.substring(3)).map(s -> "##*" + s);
|
return getNamespacedRegistrySuggestions(BlockCategory.REGISTRY, tag.substring(3)).map(s -> "##*" + s);
|
||||||
} else {
|
} else {
|
||||||
@ -139,12 +140,12 @@ public final class SuggestionHelper {
|
|||||||
|
|
||||||
public static <V extends Keyed> Stream<String> getRegistrySuggestions(Registry<V> registry, String input) {
|
public static <V extends Keyed> Stream<String> getRegistrySuggestions(Registry<V> registry, String input) {
|
||||||
if (registry instanceof NamespacedRegistry) {
|
if (registry instanceof NamespacedRegistry) {
|
||||||
return getNamespacedRegistrySuggestions(((NamespacedRegistry<V>) registry), input);
|
return getNamespacedRegistrySuggestions(((NamespacedRegistry<?>) registry), input);
|
||||||
}
|
}
|
||||||
return limitByPrefix(registry.keySet().stream(), input).stream();
|
return limitByPrefix(registry.keySet().stream(), input).stream();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <V extends Keyed> Stream<String> getNamespacedRegistrySuggestions(NamespacedRegistry<V> registry, String input) {
|
public static <V extends Keyed> Stream<String> getNamespacedRegistrySuggestions(NamespacedRegistry<?> registry, String input) {
|
||||||
if (input.isEmpty() || input.equals(":")) {
|
if (input.isEmpty() || input.equals(":")) {
|
||||||
final Set<String> namespaces = registry.getKnownNamespaces();
|
final Set<String> namespaces = registry.getKnownNamespaces();
|
||||||
if (namespaces.size() == 1) {
|
if (namespaces.size() == 1) {
|
||||||
|
@ -3,18 +3,19 @@ package com.sk89q.worldedit.event.extent;
|
|||||||
import com.sk89q.worldedit.entity.Player;
|
import com.sk89q.worldedit.entity.Player;
|
||||||
import com.sk89q.worldedit.event.Cancellable;
|
import com.sk89q.worldedit.event.Cancellable;
|
||||||
import com.sk89q.worldedit.event.Event;
|
import com.sk89q.worldedit.event.Event;
|
||||||
|
import com.sk89q.worldedit.extension.platform.Actor;
|
||||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
|
||||||
public class PlayerSaveClipboardEvent extends Event implements Cancellable {
|
public class ActorSaveClipboardEvent extends Event implements Cancellable {
|
||||||
private final Player player;
|
private final Actor actor;
|
||||||
private final Clipboard clipboard;
|
private final Clipboard clipboard;
|
||||||
private final URI source, destination;
|
private final URI source, destination;
|
||||||
private boolean cancelled;
|
private boolean cancelled;
|
||||||
|
|
||||||
public PlayerSaveClipboardEvent(Player player, Clipboard clipboard, URI source, URI destination) {
|
public ActorSaveClipboardEvent(Actor actor, Clipboard clipboard, URI source, URI destination) {
|
||||||
this.player = player;
|
this.actor = actor;
|
||||||
this.clipboard = clipboard;
|
this.clipboard = clipboard;
|
||||||
this.source = source;
|
this.source = source;
|
||||||
this.destination = destination;
|
this.destination = destination;
|
||||||
@ -42,7 +43,7 @@ public class PlayerSaveClipboardEvent extends Event implements Cancellable {
|
|||||||
return clipboard;
|
return clipboard;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Player getPlayer() {
|
public Actor getActor() {
|
||||||
return player;
|
return actor;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -123,10 +123,7 @@ public class AbstractDelegateExtent implements Extent, LightingExtent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public World getWorld() {
|
|
||||||
return getExtent().getWorld();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Bounds
|
Bounds
|
||||||
|
@ -52,6 +52,7 @@ import com.sk89q.worldedit.registry.state.PropertyGroup;
|
|||||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||||
import com.sk89q.worldedit.util.Countable;
|
import com.sk89q.worldedit.util.Countable;
|
||||||
import com.sk89q.worldedit.util.Location;
|
import com.sk89q.worldedit.util.Location;
|
||||||
|
import com.sk89q.worldedit.world.World;
|
||||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||||
import com.sk89q.worldedit.world.block.BlockState;
|
import com.sk89q.worldedit.world.block.BlockState;
|
||||||
@ -609,7 +610,7 @@ public interface Extent extends InputExtent, OutputExtent {
|
|||||||
|
|
||||||
Vector3 center = region.getCenter();
|
Vector3 center = region.getCenter();
|
||||||
Region centerRegion = new CuboidRegion(
|
Region centerRegion = new CuboidRegion(
|
||||||
getWorld(), // Causes clamping of Y range
|
this instanceof World ? (World) this : null, // Causes clamping of Y range
|
||||||
BlockVector3.at(((int) center.getX()), ((int) center.getY()), ((int) center.getZ())),
|
BlockVector3.at(((int) center.getX()), ((int) center.getY()), ((int) center.getZ())),
|
||||||
BlockVector3.at(MathUtils.roundHalfUp(center.getX()),
|
BlockVector3.at(MathUtils.roundHalfUp(center.getX()),
|
||||||
center.getY(), MathUtils.roundHalfUp(center.getZ())));
|
center.getY(), MathUtils.roundHalfUp(center.getZ())));
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.extent;
|
package com.sk89q.worldedit.extent;
|
||||||
|
|
||||||
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.entity.BaseEntity;
|
import com.sk89q.worldedit.entity.BaseEntity;
|
||||||
import com.sk89q.worldedit.entity.Entity;
|
import com.sk89q.worldedit.entity.Entity;
|
||||||
@ -91,6 +92,11 @@ public class NullExtent implements Extent {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setTile(int x, int y, int z, CompoundTag tile) throws WorldEditException {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -59,9 +59,6 @@ public class RegionVisitor implements Operation {
|
|||||||
this.iterable = iterable;
|
this.iterable = iterable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RegionVisitor(Region region, RegionFunction regionFunction, EditSession editSession) {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of affected objects.
|
* Get the number of affected objects.
|
||||||
*
|
*
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.session.request;
|
package com.sk89q.worldedit.session.request;
|
||||||
|
|
||||||
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
import com.sk89q.worldedit.entity.BaseEntity;
|
import com.sk89q.worldedit.entity.BaseEntity;
|
||||||
@ -95,6 +96,11 @@ public class RequestExtent implements Extent {
|
|||||||
return getExtent().setBlock(position, block);
|
return getExtent().setBlock(position, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setTile(int x, int y, int z, CompoundTag tile) throws WorldEditException {
|
||||||
|
return getExtent().setTile(x, y, z, tile);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
||||||
return getExtent().setBiome(position, biome);
|
return getExtent().setBiome(position, biome);
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
package com.sk89q.worldedit.world;
|
package com.sk89q.worldedit.world;
|
||||||
|
|
||||||
|
import com.sk89q.jnbt.CompoundTag;
|
||||||
import com.sk89q.worldedit.EditSession;
|
import com.sk89q.worldedit.EditSession;
|
||||||
import com.sk89q.worldedit.MaxChangedBlocksException;
|
import com.sk89q.worldedit.MaxChangedBlocksException;
|
||||||
import com.sk89q.worldedit.WorldEditException;
|
import com.sk89q.worldedit.WorldEditException;
|
||||||
@ -146,6 +147,11 @@ public class NullWorld extends AbstractWorld {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setTile(int x, int y, int z, CompoundTag tile) throws WorldEditException {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseBlock getFullBlock(BlockVector3 position) {
|
public BaseBlock getFullBlock(BlockVector3 position) {
|
||||||
return getBlock(position).toBaseBlock();
|
return getBlock(position).toBaseBlock();
|
||||||
|
Loading…
Reference in New Issue
Block a user