mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-05 20:36:42 +00:00
Javadoc and Formatting fixes. (#619)
Javadoc and Formatting fixes. Also, extremely minor code changes which have been tested. This commit is only part one of two commits that aim to fix problems with formatting in our project. In part two I will modify the Google Java Style Guide (since it closely matches our code style) for our project so there is guidance on how to format and document. * Updated PlotSquared URL * Removed plugin acronyms * Fixed a typo * Fixed grammar * Use modern block id's * Update YouTube video URL
This commit is contained in:
@ -85,8 +85,8 @@ public class AbstractDelegateExtent implements Extent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBlock getFullBlock(int x, int y, int z) {
|
||||
return extent.getFullBlock(x, y, z);
|
||||
public BlockState getBlock(int x, int y, int z) {
|
||||
return extent.getBlock(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -100,39 +100,38 @@ public class AbstractDelegateExtent implements Extent {
|
||||
*/
|
||||
|
||||
@Override
|
||||
public boolean isQueueEnabled() {
|
||||
return extent.isQueueEnabled();
|
||||
public BaseBlock getFullBlock(int x, int y, int z) {
|
||||
return extent.getFullBlock(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableQueue() {
|
||||
try {
|
||||
if (!(extent instanceof ForgetfulExtentBuffer)) { // placeholder
|
||||
extent.disableQueue();
|
||||
}
|
||||
} catch (FaweException ignored) {
|
||||
}
|
||||
if (extent instanceof AbstractDelegateExtent) {
|
||||
Extent next = ((AbstractDelegateExtent) extent).getExtent();
|
||||
new ExtentTraverser(this).setNext(next);
|
||||
} else {
|
||||
getLogger(AbstractDelegateExtent.class).debug("Cannot disable queue");
|
||||
}
|
||||
public BiomeType getBiomeType(int x, int y, int z) {
|
||||
return extent.getBiomeType(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableQueue() {
|
||||
try {
|
||||
extent.enableQueue();
|
||||
} catch (FaweException enableQueue) {
|
||||
// TODO NOT IMPLEMENTED - THIS IS IMPORTANT (ForgetfulExtentBuffer is just a placeholder for now, it won't work)
|
||||
new ExtentTraverser<>(this).setNext(new ForgetfulExtentBuffer(extent));
|
||||
}
|
||||
public BiomeType getBiome(BlockVector3 position) {
|
||||
return extent.getBiome(position);
|
||||
}
|
||||
/*
|
||||
History
|
||||
*/
|
||||
|
||||
@Override
|
||||
public int getEmmittedLight(int x, int y, int z) {
|
||||
return extent.getEmmittedLight(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSkyLight(int x, int y, int z) {
|
||||
return extent.getSkyLight(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBrightness(int x, int y, int z) {
|
||||
return extent.getBrightness(x, y, z);
|
||||
}
|
||||
|
||||
public void setChangeSet(AbstractChangeSet changeSet) {
|
||||
if (extent instanceof HistoryExtent) {
|
||||
HistoryExtent history = ((HistoryExtent) extent);
|
||||
@ -148,57 +147,6 @@ public class AbstractDelegateExtent implements Extent {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxY() {
|
||||
return extent.getMaxY();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(int x, int y, int z) {
|
||||
return extent.getBlock(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Entity createEntity(Location location, BaseEntity entity) {
|
||||
return extent.createEntity(location, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeEntity(int x, int y, int z, UUID uuid) {
|
||||
extent.removeEntity(x, y, z, uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Entity> getEntities() {
|
||||
return extent.getEntities();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Entity> getEntities(Region region) {
|
||||
return extent.getEntities(region);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean fullySupports3DBiomes() {
|
||||
return extent.fullySupports3DBiomes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeType getBiome(BlockVector3 position) {
|
||||
return extent.getBiome(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeType getBiomeType(int x, int y, int z) {
|
||||
return extent.getBiomeType(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(int x, int y, int z, BiomeType biome) {
|
||||
return extent.setBiome(x, y, z, biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends BlockStateHolder<T>> boolean setBlock(BlockVector3 position, T block)
|
||||
throws WorldEditException {
|
||||
@ -216,49 +164,29 @@ public class AbstractDelegateExtent implements Extent {
|
||||
return setBlock(x, y, z, getBlock(x, y, z).toBaseBlock(tile));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean fullySupports3DBiomes() {
|
||||
return extent.fullySupports3DBiomes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(int x, int y, int z, BiomeType biome) {
|
||||
return extent.setBiome(x, y, z, biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(BlockVector3 position, BiomeType biome) {
|
||||
return extent.setBiome(position.getX(), position.getY(), position.getZ(), biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean relight(int x, int y, int z) {
|
||||
return extent.relight(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean relightBlock(int x, int y, int z) {
|
||||
return extent.relightBlock(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean relightSky(int x, int y, int z) {
|
||||
return extent.relightSky(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSkyLight(int x, int y, int z, int value) {
|
||||
extent.setSkyLight(x, y, z, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockLight(int x, int y, int z, int value) {
|
||||
extent.setSkyLight(x, y, z, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSkyLight(int x, int y, int z) {
|
||||
return extent.getSkyLight(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEmmittedLight(int x, int y, int z) {
|
||||
return extent.getEmmittedLight(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBrightness(int x, int y, int z) {
|
||||
return extent.getBrightness(x, y, z);
|
||||
public void setSkyLight(int x, int y, int z, int value) {
|
||||
extent.setSkyLight(x, y, z, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -276,13 +204,61 @@ public class AbstractDelegateExtent implements Extent {
|
||||
return extent.getMaximumPoint();
|
||||
}
|
||||
|
||||
protected Operation commitBefore() {
|
||||
return null;
|
||||
@Override
|
||||
public List<? extends Entity> getEntities(Region region) {
|
||||
return extent.getEntities(region);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable
|
||||
Operation commit() {
|
||||
public List<? extends Entity> getEntities() {
|
||||
return extent.getEntities();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Entity createEntity(Location location, BaseEntity entity) {
|
||||
return extent.createEntity(location, entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeEntity(int x, int y, int z, UUID uuid) {
|
||||
extent.removeEntity(x, y, z, uuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isQueueEnabled() {
|
||||
return extent.isQueueEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enableQueue() {
|
||||
try {
|
||||
extent.enableQueue();
|
||||
} catch (FaweException enableQueue) {
|
||||
// TODO NOT IMPLEMENTED - THIS IS IMPORTANT (ForgetfulExtentBuffer is just a placeholder for now, it won't work)
|
||||
new ExtentTraverser<>(this).setNext(new ForgetfulExtentBuffer(extent));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableQueue() {
|
||||
try {
|
||||
if (!(extent instanceof ForgetfulExtentBuffer)) { // placeholder
|
||||
extent.disableQueue();
|
||||
}
|
||||
} catch (FaweException ignored) {
|
||||
}
|
||||
if (extent instanceof AbstractDelegateExtent) {
|
||||
Extent next = ((AbstractDelegateExtent) extent).getExtent();
|
||||
new ExtentTraverser(this).setNext(next);
|
||||
} else {
|
||||
getLogger(AbstractDelegateExtent.class).debug("Cannot disable queue");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Operation commit() {
|
||||
Operation ours = commitBefore();
|
||||
Operation other = null;
|
||||
if (extent != this) {
|
||||
@ -299,6 +275,26 @@ public class AbstractDelegateExtent implements Extent {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxY() {
|
||||
return extent.getMaxY();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean relight(int x, int y, int z) {
|
||||
return extent.relight(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean relightBlock(int x, int y, int z) {
|
||||
return extent.relightBlock(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean relightSky(int x, int y, int z) {
|
||||
return extent.relightSky(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Extent addProcessor(IBatchProcessor processor) {
|
||||
if (Settings.IMP.EXPERIMENTAL.OTHER) {
|
||||
@ -343,4 +339,8 @@ public class AbstractDelegateExtent implements Extent {
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
protected Operation commitBefore() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +141,8 @@ public interface Extent extends InputExtent, OutputExtent {
|
||||
* @param location the location
|
||||
* @return a reference to the created entity, or null if the entity could not be created
|
||||
*/
|
||||
default @Nullable Entity createEntity(Location location, BaseEntity entity) {
|
||||
@Nullable
|
||||
default Entity createEntity(Location location, BaseEntity entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -164,11 +165,15 @@ public interface Extent extends InputExtent, OutputExtent {
|
||||
}
|
||||
|
||||
default void enableQueue() {
|
||||
if (!isQueueEnabled()) throw FaweException._enableQueue;
|
||||
if (!isQueueEnabled()) {
|
||||
throw FaweException._enableQueue;
|
||||
}
|
||||
}
|
||||
|
||||
default void disableQueue() {
|
||||
if (isQueueEnabled()) throw FaweException._disableQueue;
|
||||
if (isQueueEnabled()) {
|
||||
throw FaweException._disableQueue;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -281,18 +286,26 @@ public interface Extent extends InputExtent, OutputExtent {
|
||||
int offset = state ? 0 : 1;
|
||||
for (int d = 0; d <= clearance; d++) {
|
||||
int y1 = y + d;
|
||||
if (mask.test(MutableBlockVector3.get(x, y1, z)) != state) return y1 - offset;
|
||||
if (mask.test(MutableBlockVector3.get(x, y1, z)) != state) {
|
||||
return y1 - offset;
|
||||
}
|
||||
int y2 = y - d;
|
||||
if (mask.test(MutableBlockVector3.get(x, y2, z)) != state) return y2 + offset;
|
||||
if (mask.test(MutableBlockVector3.get(x, y2, z)) != state) {
|
||||
return y2 + offset;
|
||||
}
|
||||
}
|
||||
if (clearanceAbove != clearanceBelow) {
|
||||
if (clearanceAbove < clearanceBelow) {
|
||||
for (int layer = y - clearance - 1; layer >= minY; layer--) {
|
||||
if (mask.test(MutableBlockVector3.get(x, layer, z)) != state) return layer + offset;
|
||||
if (mask.test(MutableBlockVector3.get(x, layer, z)) != state) {
|
||||
return layer + offset;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int layer = y + clearance + 1; layer <= maxY; layer++) {
|
||||
if (mask.test(MutableBlockVector3.get(x, layer, z)) != state) return layer - offset;
|
||||
if (mask.test(MutableBlockVector3.get(x, layer, z)) != state) {
|
||||
return layer - offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -310,26 +323,34 @@ public interface Extent extends InputExtent, OutputExtent {
|
||||
for (int d = 0; d <= clearance; d++) {
|
||||
int y1 = y + d;
|
||||
block = getBlock(x, y1, z);
|
||||
if (block.getMaterial().isMovementBlocker() == state && block.getBlockType() != BlockTypes.__RESERVED__) return y1 - offset;
|
||||
if (block.getMaterial().isMovementBlocker() == state && block.getBlockType() != BlockTypes.__RESERVED__) {
|
||||
return y1 - offset;
|
||||
}
|
||||
int y2 = y - d;
|
||||
block = getBlock(x, y2, z);
|
||||
if (block.getMaterial().isMovementBlocker() == state && block.getBlockType() != BlockTypes.__RESERVED__) return y2 + offset;
|
||||
if (block.getMaterial().isMovementBlocker() == state && block.getBlockType() != BlockTypes.__RESERVED__) {
|
||||
return y2 + offset;
|
||||
}
|
||||
}
|
||||
if (clearanceAbove != clearanceBelow) {
|
||||
if (clearanceAbove < clearanceBelow) {
|
||||
for (int layer = y - clearance - 1; layer >= minY; layer--) {
|
||||
block = getBlock(x, layer, z);
|
||||
if (block.getMaterial().isMovementBlocker() == state && block.getBlockType() != BlockTypes.__RESERVED__) return layer + offset;
|
||||
if (block.getMaterial().isMovementBlocker() == state && block.getBlockType() != BlockTypes.__RESERVED__) {
|
||||
return layer + offset;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int layer = y + clearance + 1; layer <= maxY; layer++) {
|
||||
block = getBlock(x, layer, z);
|
||||
if (block.getMaterial().isMovementBlocker() == state && block.getBlockType() != BlockTypes.__RESERVED__) return layer - offset;
|
||||
if (block.getMaterial().isMovementBlocker() == state && block.getBlockType() != BlockTypes.__RESERVED__) {
|
||||
return layer - offset;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int result = state ? failedMin : failedMax;
|
||||
if(result > 0 && !ignoreAir) {
|
||||
if (result > 0 && !ignoreAir) {
|
||||
block = getBlock(x, result, z);
|
||||
return block.getBlockType().getMaterial().isAir() ? -1 : result;
|
||||
}
|
||||
@ -464,7 +485,9 @@ public interface Extent extends InputExtent, OutputExtent {
|
||||
ExtentTraverser<Extent> next = traverser.next();
|
||||
if (next != null) {
|
||||
Extent child = next.get();
|
||||
if (child instanceof NullExtent) return true;
|
||||
if (child instanceof NullExtent) {
|
||||
return true;
|
||||
}
|
||||
traverser.setNext(nullExtent);
|
||||
child.cancel();
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public interface InputExtent {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a immutable snapshot of the block at the given location.
|
||||
* Get an immutable snapshot of the block at the given location.
|
||||
*
|
||||
* @param position position of the block
|
||||
* @return the block
|
||||
|
@ -124,7 +124,9 @@ public class MaskingExtent extends AbstractDelegateExtent implements IBatchProce
|
||||
|
||||
@Override
|
||||
public Extent construct(Extent child) {
|
||||
if (child == getExtent()) return this;
|
||||
if (child == getExtent()) {
|
||||
return this;
|
||||
}
|
||||
return new MaskingExtent(child, this.mask.copy(), this.threadIdToFilter);
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,6 @@ public class BlockArrayClipboard implements Clipboard {
|
||||
|
||||
@Override
|
||||
public void setOrigin(BlockVector3 origin) {
|
||||
// this.origin = origin;
|
||||
getParent().setOrigin(origin.subtract(region.getMinimumPoint()));
|
||||
}
|
||||
|
||||
@ -117,9 +116,9 @@ public class BlockArrayClipboard implements Clipboard {
|
||||
@Override
|
||||
public BlockState getBlock(BlockVector3 position) {
|
||||
if (region.contains(position)) {
|
||||
int x = position.getBlockX()- origin.getX();
|
||||
int y = position.getBlockY()- origin.getY();
|
||||
int z = position.getBlockZ()- origin.getZ();
|
||||
int x = position.getBlockX() - origin.getX();
|
||||
int y = position.getBlockY() - origin.getY();
|
||||
int z = position.getBlockZ() - origin.getZ();
|
||||
return getParent().getBlock(x, y, z);
|
||||
}
|
||||
|
||||
@ -128,10 +127,10 @@ public class BlockArrayClipboard implements Clipboard {
|
||||
|
||||
@Override
|
||||
public BaseBlock getFullBlock(BlockVector3 position) {
|
||||
if(region.contains(position)) {
|
||||
int x = position.getBlockX()- origin.getX();
|
||||
int y = position.getBlockY()- origin.getY();
|
||||
int z = position.getBlockZ()- origin.getZ();
|
||||
if (region.contains(position)) {
|
||||
int x = position.getBlockX() - origin.getX();
|
||||
int y = position.getBlockY() - origin.getY();
|
||||
int z = position.getBlockZ() - origin.getZ();
|
||||
return getParent().getFullBlock(x, y, z);
|
||||
}
|
||||
return BlockTypes.AIR.getDefaultState().toBaseBlock();
|
||||
@ -320,8 +319,11 @@ public class BlockArrayClipboard implements Clipboard {
|
||||
public static class ClipboardEntity implements Entity {
|
||||
private final BaseEntity entity;
|
||||
private final Clipboard clipboard;
|
||||
private final double x, y, z;
|
||||
private final float yaw, pitch;
|
||||
private final double x;
|
||||
private final double y;
|
||||
private final double z;
|
||||
private final float yaw;
|
||||
private final float pitch;
|
||||
|
||||
public ClipboardEntity(Location loc, BaseEntity entity) {
|
||||
this((Clipboard) loc.getExtent(), loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), entity);
|
||||
|
@ -129,7 +129,7 @@ public interface Clipboard extends Extent, Iterable<BlockVector3>, Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove entity from clipboard
|
||||
* Remove entity from clipboard.
|
||||
*/
|
||||
void removeEntity(Entity entity);
|
||||
|
||||
@ -184,7 +184,7 @@ public interface Clipboard extends Extent, Iterable<BlockVector3>, Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Forwards to paste(world, to, true, true, null)
|
||||
* Forwards to {@link #paste(World, BlockVector3, boolean, boolean, Transform)}.
|
||||
*/
|
||||
default EditSession paste(World world, BlockVector3 to) {
|
||||
return paste(world, to, true, true, null);
|
||||
@ -204,7 +204,7 @@ public interface Clipboard extends Extent, Iterable<BlockVector3>, Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Save this schematic to a stream
|
||||
* Save this schematic to a stream.
|
||||
*/
|
||||
default void save(OutputStream stream, ClipboardFormat format) throws IOException {
|
||||
checkNotNull(stream);
|
||||
@ -220,7 +220,7 @@ public interface Clipboard extends Extent, Iterable<BlockVector3>, Closeable {
|
||||
}
|
||||
|
||||
/**
|
||||
* Paste this schematic in a world
|
||||
* Paste this schematic in a world.
|
||||
*/
|
||||
default EditSession paste(World world, BlockVector3 to, boolean allowUndo, boolean pasteAir,
|
||||
boolean copyEntities, @Nullable Transform transform) {
|
||||
|
@ -34,6 +34,7 @@ import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
@ -72,7 +73,7 @@ public enum BuiltInClipboardFormat implements ClipboardFormat {
|
||||
|
||||
@Override
|
||||
public boolean isFormat(File file) {
|
||||
String name = file.getName().toLowerCase();
|
||||
String name = file.getName().toLowerCase(Locale.ROOT);
|
||||
return name.endsWith(".schematic") || name.endsWith(".mcedit") || name.endsWith(".mce");
|
||||
}
|
||||
},
|
||||
@ -108,7 +109,7 @@ public enum BuiltInClipboardFormat implements ClipboardFormat {
|
||||
|
||||
@Override
|
||||
public boolean isFormat(File file) {
|
||||
String name = file.getName().toLowerCase();
|
||||
String name = file.getName().toLowerCase(Locale.ROOT);
|
||||
return name.endsWith(".schem") || name.endsWith(".sponge");
|
||||
}
|
||||
|
||||
@ -141,13 +142,13 @@ public enum BuiltInClipboardFormat implements ClipboardFormat {
|
||||
|
||||
@Override
|
||||
public boolean isFormat(File file) {
|
||||
String name = file.getName().toLowerCase();
|
||||
String name = file.getName().toLowerCase(Locale.ROOT);
|
||||
return name.endsWith(".nbt");
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Isometric PNG writer
|
||||
* Isometric PNG writer.
|
||||
*/
|
||||
PNG("png", "image") {
|
||||
|
||||
|
@ -101,7 +101,7 @@ public interface ClipboardFormat {
|
||||
|
||||
/**
|
||||
* Sets the actor's clipboard.
|
||||
* @param actor
|
||||
* @param actor the actor
|
||||
* @param uri the URI of the schematic to hold
|
||||
* @param inputStream the input stream
|
||||
* @throws IOException thrown on I/O error
|
||||
|
@ -126,7 +126,7 @@ public class ClipboardFormats {
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect the format using the given extension
|
||||
* Detect the format using the given extension.
|
||||
*
|
||||
* @param extension the extension
|
||||
* @return the format, otherwise null if one cannot be detected
|
||||
@ -195,8 +195,8 @@ public class ClipboardFormats {
|
||||
return null;
|
||||
}
|
||||
File working = worldEdit.getWorkingDirectoryFile(config.saveDir);
|
||||
File dir = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS ?
|
||||
new File(working, player.getUniqueId().toString()) : working;
|
||||
File dir = Settings.IMP.PATHS.PER_PLAYER_SCHEMATICS
|
||||
? new File(working, player.getUniqueId().toString()) : working;
|
||||
File f;
|
||||
if (input.startsWith("#")) {
|
||||
String[] extensions;
|
||||
|
@ -80,9 +80,14 @@ public class FastSchematicReader extends NBTSchematicReader {
|
||||
private List<Map<String, Object>> tiles;
|
||||
private List<Map<String, Object>> entities;
|
||||
|
||||
private int width, height, length;
|
||||
private int offsetX, offsetY, offsetZ;
|
||||
private char[] palette, biomePalette;
|
||||
private int width;
|
||||
private int height;
|
||||
private int length;
|
||||
private int offsetX;
|
||||
private int offsetY;
|
||||
private int offsetZ;
|
||||
private char[] palette;
|
||||
private char[] biomePalette;
|
||||
private BlockVector3 min = BlockVector3.ZERO;
|
||||
|
||||
|
||||
@ -97,22 +102,30 @@ public class FastSchematicReader extends NBTSchematicReader {
|
||||
}
|
||||
|
||||
private String fix(String palettePart) {
|
||||
if (fixer == null || dataVersion == -1) return palettePart;
|
||||
if (fixer == null || dataVersion == -1) {
|
||||
return palettePart;
|
||||
}
|
||||
return fixer.fixUp(DataFixer.FixTypes.BLOCK_STATE, palettePart, dataVersion);
|
||||
}
|
||||
|
||||
private CompoundTag fixBlockEntity(CompoundTag tag) {
|
||||
if (fixer == null || dataVersion == -1) return tag;
|
||||
if (fixer == null || dataVersion == -1) {
|
||||
return tag;
|
||||
}
|
||||
return fixer.fixUp(DataFixer.FixTypes.BLOCK_ENTITY, tag, dataVersion);
|
||||
}
|
||||
|
||||
private CompoundTag fixEntity(CompoundTag tag) {
|
||||
if (fixer == null || dataVersion == -1) return tag;
|
||||
if (fixer == null || dataVersion == -1) {
|
||||
return tag;
|
||||
}
|
||||
return fixer.fixUp(DataFixer.FixTypes.ENTITY, tag, dataVersion);
|
||||
}
|
||||
|
||||
private String fixBiome(String biomePalettePart) {
|
||||
if(fixer == null || dataVersion == -1) return biomePalettePart;
|
||||
if (fixer == null || dataVersion == -1) {
|
||||
return biomePalettePart;
|
||||
}
|
||||
return fixer.fixUp(DataFixer.FixTypes.BIOME, biomePalettePart, dataVersion);
|
||||
}
|
||||
|
||||
@ -208,8 +221,12 @@ public class FastSchematicReader extends NBTSchematicReader {
|
||||
throw new IOException("This schematic version is currently not supported");
|
||||
}
|
||||
|
||||
if (blocks != null) blocks.close();
|
||||
if (biomes != null) biomes.close();
|
||||
if (blocks != null) {
|
||||
blocks.close();
|
||||
}
|
||||
if (biomes != null) {
|
||||
biomes.close();
|
||||
}
|
||||
blocks = null;
|
||||
biomes = null;
|
||||
|
||||
@ -285,7 +302,9 @@ public class FastSchematicReader extends NBTSchematicReader {
|
||||
CompoundTag tile = FaweCache.IMP.asTag(tileRaw);
|
||||
|
||||
int[] pos = tile.getIntArray("Pos");
|
||||
int x,y,z;
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
if (pos.length != 3) {
|
||||
if (!tile.containsKey("x") || !tile.containsKey("y") || !tile.containsKey("z")) {
|
||||
return null;
|
||||
|
@ -190,7 +190,9 @@ public class MCEditSchematicReader extends NBTSchematicReader {
|
||||
Map<BlockVector3, BlockState> blockStates = new HashMap<>();
|
||||
|
||||
for (Tag tag : tileEntities) {
|
||||
if (!(tag instanceof CompoundTag)) continue;
|
||||
if (!(tag instanceof CompoundTag)) {
|
||||
continue;
|
||||
}
|
||||
CompoundTag t = (CompoundTag) tag;
|
||||
Map<String, Tag> values = new HashMap<>(t.getValue());
|
||||
String id = t.getString("id");
|
||||
|
@ -95,7 +95,7 @@ public class SchematicReader implements ClipboardReader {
|
||||
private NBTInputStream inputStream;
|
||||
private InputStream rootStream;
|
||||
|
||||
// private final DataFixer fixer; TODO
|
||||
// private final DataFixer fixer; TODO
|
||||
|
||||
private FastByteArrayOutputStream idOut = new FastByteArrayOutputStream();
|
||||
private FastByteArrayOutputStream dataOut = new FastByteArrayOutputStream();
|
||||
@ -110,9 +110,15 @@ public class SchematicReader implements ClipboardReader {
|
||||
private List<Map<String, Object>> tiles;
|
||||
private List<Map<String, Object>> entities;
|
||||
|
||||
private int width, height, length;
|
||||
private int offsetX, offsetY, offsetZ;
|
||||
private int originX, originY, originZ;
|
||||
private int width;
|
||||
private int height;
|
||||
private int length;
|
||||
private int offsetX;
|
||||
private int offsetY;
|
||||
private int offsetZ;
|
||||
private int originX;
|
||||
private int originY;
|
||||
private int originZ;
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
@ -249,10 +255,18 @@ public class SchematicReader implements ClipboardReader {
|
||||
StreamDelegate root = createDelegate();
|
||||
inputStream.readNamedTagLazy(root);
|
||||
|
||||
if (ids != null) ids.close();
|
||||
if (datas != null) datas.close();
|
||||
if (adds != null) adds.close();
|
||||
if (biomes != null) biomes.close();
|
||||
if (ids != null) {
|
||||
ids.close();
|
||||
}
|
||||
if (datas != null) {
|
||||
datas.close();
|
||||
}
|
||||
if (adds != null) {
|
||||
adds.close();
|
||||
}
|
||||
if (biomes != null) {
|
||||
biomes.close();
|
||||
}
|
||||
ids = null;
|
||||
datas = null;
|
||||
adds = null;
|
||||
@ -265,7 +279,7 @@ public class SchematicReader implements ClipboardReader {
|
||||
}
|
||||
|
||||
Clipboard clipboard = createOutput.apply(dimensions);
|
||||
try (InputStream dataIn = new LZ4BlockInputStream(new FastByteArraysInputStream(dataOut.toByteArrays()));InputStream idIn = new LZ4BlockInputStream(new FastByteArraysInputStream(idOut.toByteArrays()))) {
|
||||
try (InputStream dataIn = new LZ4BlockInputStream(new FastByteArraysInputStream(dataOut.toByteArrays())); InputStream idIn = new LZ4BlockInputStream(new FastByteArraysInputStream(idOut.toByteArrays()))) {
|
||||
if (addOut != null) {
|
||||
try (FaweInputStream addIn = new FaweInputStream(new LZ4BlockInputStream(new FastByteArraysInputStream(addOut.toByteArrays())))) {
|
||||
if (clipboard instanceof LinearClipboard) {
|
||||
@ -368,7 +382,9 @@ public class SchematicReader implements ClipboardReader {
|
||||
private void fixStates(Clipboard fc) {
|
||||
for (BlockVector3 pos : fc) {
|
||||
BlockState block = pos.getBlock(fc);
|
||||
if (block.getMaterial().isAir()) continue;
|
||||
if (block.getMaterial().isAir()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int x = pos.getX();
|
||||
int y = pos.getY();
|
||||
@ -425,13 +441,23 @@ public class SchematicReader implements ClipboardReader {
|
||||
}
|
||||
} else {
|
||||
int group = group(type);
|
||||
if (group == -1) return;
|
||||
if (group == -1) {
|
||||
return;
|
||||
}
|
||||
BlockState set = block;
|
||||
|
||||
if (set.getState(PropertyKey.NORTH) == Boolean.FALSE && merge(fc, group, x, y, z - 1)) set = set.with(PropertyKey.NORTH, true);
|
||||
if (set.getState(PropertyKey.EAST) == Boolean.FALSE && merge(fc, group, x + 1, y, z)) set = set.with(PropertyKey.EAST, true);
|
||||
if (set.getState(PropertyKey.SOUTH) == Boolean.FALSE && merge(fc, group, x, y, z + 1)) set = set.with(PropertyKey.SOUTH, true);
|
||||
if (set.getState(PropertyKey.WEST) == Boolean.FALSE && merge(fc, group, x - 1, y, z)) set = set.with(PropertyKey.WEST, true);
|
||||
if (set.getState(PropertyKey.NORTH) == Boolean.FALSE && merge(fc, group, x, y, z - 1)) {
|
||||
set = set.with(PropertyKey.NORTH, true);
|
||||
}
|
||||
if (set.getState(PropertyKey.EAST) == Boolean.FALSE && merge(fc, group, x + 1, y, z)) {
|
||||
set = set.with(PropertyKey.EAST, true);
|
||||
}
|
||||
if (set.getState(PropertyKey.SOUTH) == Boolean.FALSE && merge(fc, group, x, y, z + 1)) {
|
||||
set = set.with(PropertyKey.SOUTH, true);
|
||||
}
|
||||
if (set.getState(PropertyKey.WEST) == Boolean.FALSE && merge(fc, group, x - 1, y, z)) {
|
||||
set = set.with(PropertyKey.WEST, true);
|
||||
}
|
||||
|
||||
if (group == 2) {
|
||||
int ns = (set.getState(PropertyKey.NORTH) ? 1 : 0) + ((Boolean) set.getState(PropertyKey.SOUTH) ? 1 : 0);
|
||||
@ -441,7 +467,9 @@ public class SchematicReader implements ClipboardReader {
|
||||
}
|
||||
}
|
||||
|
||||
if (set != block) pos.setBlock(fc, set);
|
||||
if (set != block) {
|
||||
pos.setBlock(fc, set);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,5 +24,6 @@ import com.sk89q.worldedit.world.entity.EntityType;
|
||||
|
||||
public interface EntityNBTCompatibilityHandler {
|
||||
boolean isAffectedEntity(EntityType type, CompoundTag entityTag);
|
||||
|
||||
CompoundTag updateNBT(EntityType type, CompoundTag entityTag);
|
||||
}
|
||||
|
@ -35,8 +35,12 @@ public abstract class BlockBag {
|
||||
*/
|
||||
public void storeDroppedBlock(BlockState blockState) throws BlockBagException {
|
||||
BlockState dropped = blockState; // TODO BlockType.getBlockBagItem(id, data);
|
||||
if (dropped == null) return;
|
||||
if (dropped.getBlockType().getMaterial().isAir()) return;
|
||||
if (dropped == null) {
|
||||
return;
|
||||
}
|
||||
if (dropped.getBlockType().getMaterial().isAir()) {
|
||||
return;
|
||||
}
|
||||
|
||||
storeBlock(dropped);
|
||||
}
|
||||
@ -55,8 +59,10 @@ public abstract class BlockBag {
|
||||
}
|
||||
fetchBlock(blockState);
|
||||
} catch (OutOfBlocksException e) {
|
||||
BlockState placed = blockState;// TODO BlockType.getBlockBagItem(id, data);
|
||||
if (placed == null || placed.getBlockType().getMaterial().isAir()) throw e; // TODO: check
|
||||
BlockState placed = blockState; // TODO BlockType.getBlockBagItem(id, data);
|
||||
if (placed == null || placed.getBlockType().getMaterial().isAir()) {
|
||||
throw e; // TODO: check
|
||||
}
|
||||
|
||||
fetchBlock(placed);
|
||||
}
|
||||
|
@ -64,7 +64,8 @@ public class BlockBagExtent extends AbstractDelegateExtent {
|
||||
*
|
||||
* @return a block bag, which may be null if none is used
|
||||
*/
|
||||
public @Nullable BlockBag getBlockBag() {
|
||||
@Nullable
|
||||
public BlockBag getBlockBag() {
|
||||
return blockBag;
|
||||
}
|
||||
|
||||
@ -76,6 +77,7 @@ public class BlockBagExtent extends AbstractDelegateExtent {
|
||||
public void setBlockBag(@Nullable BlockBag blockBag) {
|
||||
this.blockBag = blockBag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of missing blocks and clears the list for the next
|
||||
* operation.
|
||||
@ -122,6 +124,7 @@ public class BlockBagExtent extends AbstractDelegateExtent {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return super.setBlock(x, y, z, block);
|
||||
}
|
||||
}
|
||||
|
@ -291,7 +291,9 @@ public class BlockTransformExtent extends ResettableExtent {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (newIndex != null) return newIndex;
|
||||
if (newIndex != null) {
|
||||
return newIndex;
|
||||
}
|
||||
}
|
||||
return newIndex;
|
||||
}
|
||||
|
Reference in New Issue
Block a user