mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-12 04:48:34 +00:00
Current Progress #3
This commit is contained in:
@ -51,7 +51,7 @@ import javax.annotation.Nullable;
|
||||
public class AbstractDelegateExtent implements LightingExtent {
|
||||
|
||||
private transient final Extent extent;
|
||||
private MutableBlockVector mutable = new MutableBlockVector(0, 0, 0);
|
||||
// private MutableBlockVector mutable = new MutableBlockVector(0, 0, 0);
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
@ -126,10 +126,10 @@ public class AbstractDelegateExtent implements LightingExtent {
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(int x, int y, int z) {
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
mutable.mutZ(z);
|
||||
return extent.getLazyBlock(mutable);
|
||||
// mutable.mutX(x);
|
||||
// mutable.mutY(y);
|
||||
// mutable.mutZ(z);
|
||||
return extent.getLazyBlock(new BlockVector3(x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -139,10 +139,10 @@ public class AbstractDelegateExtent implements LightingExtent {
|
||||
|
||||
@Override
|
||||
public boolean setBlock(int x, int y, int z, BlockStateHolder block) throws WorldEditException {
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
mutable.mutZ(z);
|
||||
return setBlock(mutable, block);
|
||||
// mutable.mutX(x);
|
||||
// mutable.mutY(y);
|
||||
// mutable.mutZ(z);
|
||||
return setBlock(new BlockVector3(x, y, z), block);
|
||||
}
|
||||
|
||||
public BlockState getBlock(BlockVector3 position) {
|
||||
|
@ -19,16 +19,12 @@
|
||||
|
||||
package com.sk89q.worldedit.extent;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.history.change.BlockChange;
|
||||
@ -38,13 +34,9 @@ import com.sk89q.worldedit.history.changeset.ChangeSet;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
<<<<<<< HEAD
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
=======
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -71,15 +63,9 @@ public class ChangeSetExtent extends AbstractDelegateExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException {
|
||||
BlockStateHolder previous = getBlock(location);
|
||||
changeSet.add(new BlockChange(location.toBlockVector(), previous, block));
|
||||
=======
|
||||
public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException {
|
||||
BaseBlock previous = getFullBlock(location);
|
||||
BlockStateHolder previous = getBlock(location);
|
||||
changeSet.add(new BlockChange(location, previous, block));
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
return super.setBlock(location, block);
|
||||
}
|
||||
|
||||
|
@ -19,23 +19,15 @@
|
||||
|
||||
package com.sk89q.worldedit.extent;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.function.mask.Mask;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
=======
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
|
||||
@ -47,7 +39,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
public class MaskingExtent extends AbstractDelegateExtent {
|
||||
|
||||
private Mask mask;
|
||||
private MutableBlockVector mutable = new MutableBlockVector();
|
||||
// private MutableBlockVector mutable = new MutableBlockVector();
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
@ -86,13 +78,13 @@ public class MaskingExtent extends AbstractDelegateExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(Vector2D position, BaseBiome biome) {
|
||||
return mask.test(mutable.setComponents(position.getBlockX(), 0, position.getBlockZ())) && super.setBiome(position, biome);
|
||||
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
||||
return mask.test(position.toBlockVector3()) && super.setBiome(position, biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(int x, int y, int z, BaseBiome biome) {
|
||||
return mask.test(mutable.setComponents(x, y, z)) && super.setBiome(x, y, z, biome);
|
||||
return mask.test(new BlockVector3(x, y, z)) && super.setBiome(x, y, z, biome);
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,35 +20,27 @@
|
||||
package com.sk89q.worldedit.extent;
|
||||
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.blocks.LazyBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
=======
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
@ -60,13 +52,10 @@ import java.util.List;
|
||||
*/
|
||||
public class NullExtent implements Extent {
|
||||
|
||||
<<<<<<< HEAD
|
||||
private final Vector nullPoint = new Vector(0, 0, 0);
|
||||
private final BlockVector3 nullPoint = new BlockVector3(0, 0, 0);
|
||||
|
||||
public static final NullExtent INSTANCE = new NullExtent();
|
||||
|
||||
=======
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
@Override
|
||||
public BlockVector3 getMinimumPoint() {
|
||||
return BlockVector3.ZERO;
|
||||
@ -98,19 +87,13 @@ public class NullExtent implements Extent {
|
||||
return BlockTypes.AIR.getDefaultState();
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public BlockState getLazyBlock(Vector position) {
|
||||
public BlockState getLazyBlock(BlockVector3 position) {
|
||||
return BlockTypes.AIR.getDefaultState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getFullBlock(Vector position) {
|
||||
public BlockState getFullBlock(BlockVector3 position) {
|
||||
return new BaseBlock(getBlock(position));
|
||||
=======
|
||||
public BaseBlock getFullBlock(BlockVector3 position) {
|
||||
return getBlock(position).toBaseBlock();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -19,25 +19,20 @@
|
||||
|
||||
package com.sk89q.worldedit.extent.clipboard;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.clipboard.DiskOptimizedClipboard;
|
||||
import com.boydti.fawe.object.clipboard.FaweClipboard;
|
||||
import com.boydti.fawe.object.clipboard.FaweClipboard.ClipboardEntity;
|
||||
import com.boydti.fawe.object.clipboard.MemoryOptimizedClipboard;
|
||||
import com.boydti.fawe.object.extent.LightingExtent;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
@ -46,11 +41,7 @@ import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import java.io.Closeable;
|
||||
@ -69,16 +60,16 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
*/
|
||||
public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable {
|
||||
|
||||
<<<<<<< HEAD
|
||||
private Region region;
|
||||
private Region region;
|
||||
private BlockVector3 origin;
|
||||
public FaweClipboard IMP;
|
||||
private Vector size;
|
||||
private BlockVector3 size;
|
||||
private int mx;
|
||||
private int my;
|
||||
private int mz;
|
||||
private Vector origin;
|
||||
private MutableBlockVector mutable = new MutableBlockVector();
|
||||
|
||||
private BlockStateHolder[][][] blocks;
|
||||
private final List<ClipboardEntity> entities = new ArrayList<>();
|
||||
|
||||
public BlockArrayClipboard(Region region) {
|
||||
checkNotNull(region);
|
||||
this.region = region.clone();
|
||||
@ -88,13 +79,8 @@ public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable
|
||||
this.mx = origin.getBlockX();
|
||||
this.my = origin.getBlockY();
|
||||
this.mz = origin.getBlockZ();
|
||||
this.blocks = new BlockStateHolder[size.getBlockX()][size.getBlockY()][size.getBlockZ()];
|
||||
}
|
||||
=======
|
||||
private final Region region;
|
||||
private BlockVector3 origin;
|
||||
private final BlockStateHolder[][][] blocks;
|
||||
private final List<ClipboardEntity> entities = new ArrayList<>();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
@ -112,9 +98,9 @@ public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable
|
||||
this.mx = origin.getBlockX();
|
||||
this.my = origin.getBlockY();
|
||||
this.mz = origin.getBlockZ();
|
||||
this.blocks = new BlockStateHolder[size.getBlockX()][size.getBlockY()][size.getBlockZ()];
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
public BlockArrayClipboard(Region region, FaweClipboard clipboard) {
|
||||
checkNotNull(region);
|
||||
this.region = region.clone();
|
||||
@ -124,6 +110,7 @@ public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable
|
||||
this.my = origin.getBlockY();
|
||||
this.mz = origin.getBlockZ();
|
||||
this.IMP = clipboard;
|
||||
this.blocks = new BlockStateHolder[size.getBlockX()][size.getBlockY()][size.getBlockZ()];
|
||||
}
|
||||
|
||||
public void init(Region region, FaweClipboard fc) {
|
||||
@ -136,6 +123,7 @@ public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable
|
||||
this.mx = origin.getBlockX();
|
||||
this.my = origin.getBlockY();
|
||||
this.mz = origin.getBlockZ();
|
||||
this.blocks = new BlockStateHolder[size.getBlockX()][size.getBlockY()][size.getBlockZ()];
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -146,10 +134,6 @@ public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable
|
||||
@Override
|
||||
public void close() {
|
||||
IMP.close();
|
||||
=======
|
||||
BlockVector3 dimensions = getDimensions();
|
||||
blocks = new BlockStateHolder[dimensions.getBlockX()][dimensions.getBlockY()][dimensions.getBlockZ()];
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -189,15 +173,9 @@ public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable
|
||||
|
||||
@Override
|
||||
public List<? extends Entity> getEntities(Region region) {
|
||||
<<<<<<< HEAD
|
||||
List<Entity> filtered = new ArrayList<Entity>();
|
||||
for (Entity entity : getEntities()) {
|
||||
if (region.contains(entity.getLocation().toVector())) {
|
||||
=======
|
||||
List<Entity> filtered = new ArrayList<>();
|
||||
for (Entity entity : entities) {
|
||||
for (Entity entity : getEntities()) {
|
||||
if (region.contains(entity.getLocation().toVector().toBlockPoint())) {
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
filtered.add(entity);
|
||||
}
|
||||
}
|
||||
@ -218,18 +196,18 @@ public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable
|
||||
@Override
|
||||
public BlockState getBlock(BlockVector3 position) {
|
||||
if (region.contains(position)) {
|
||||
<<<<<<< HEAD
|
||||
//<<<<<<< HEAD
|
||||
int x = position.getBlockX() - mx;
|
||||
int y = position.getBlockY() - my;
|
||||
int z = position.getBlockZ() - mz;
|
||||
return IMP.getBlock(x, y, z);
|
||||
=======
|
||||
BlockVector3 v = position.subtract(region.getMinimumPoint());
|
||||
BlockStateHolder block = blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()];
|
||||
if (block != null) {
|
||||
return block.toImmutableState();
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
// BlockVector3 v = position.subtract(region.getMinimumPoint());
|
||||
// BlockStateHolder block = blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()];
|
||||
// if (block != null) {
|
||||
// return block.toImmutableState();
|
||||
// }
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
return EditSession.nullBlock;
|
||||
}
|
||||
@ -239,43 +217,42 @@ public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public BlockState getLazyBlock(Vector position) {
|
||||
//<<<<<<< HEAD
|
||||
public BlockState getLazyBlock(BlockVector3 position) {
|
||||
return getBlock(position);
|
||||
}
|
||||
=======
|
||||
public BaseBlock getFullBlock(BlockVector3 position) {
|
||||
if (region.contains(position)) {
|
||||
BlockVector3 v = position.subtract(region.getMinimumPoint());
|
||||
BlockStateHolder block = blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()];
|
||||
if (block != null) {
|
||||
return block.toBaseBlock();
|
||||
}
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
// public BaseBlock getFullBlock(BlockVector3 position) {
|
||||
// if (region.contains(position)) {
|
||||
// BlockVector3 v = position.subtract(region.getMinimumPoint());
|
||||
// BlockStateHolder block = blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()];
|
||||
// if (block != null) {
|
||||
// return block.toBaseBlock();
|
||||
// }
|
||||
// }
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
@Override
|
||||
public BlockState getFullBlock(Vector position) {
|
||||
public BlockState getFullBlock(BlockVector3 position) {
|
||||
return getLazyBlock(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException {
|
||||
public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException {
|
||||
if (region.contains(location)) {
|
||||
final int x = location.getBlockX();
|
||||
final int y = location.getBlockY();
|
||||
final int z = location.getBlockZ();
|
||||
return setBlock(x, y, z, block);
|
||||
=======
|
||||
public boolean setBlock(BlockVector3 position, BlockStateHolder block) throws WorldEditException {
|
||||
if (region.contains(position)) {
|
||||
BlockVector3 v = position.subtract(region.getMinimumPoint());
|
||||
blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()] = block;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
// public boolean setBlock(BlockVector3 position, BlockStateHolder block) throws WorldEditException {
|
||||
// if (region.contains(position)) {
|
||||
// BlockVector3 v = position.subtract(region.getMinimumPoint());
|
||||
// blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()] = block;
|
||||
// return true;
|
||||
// } else {
|
||||
// return false;
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -296,28 +273,18 @@ public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public BaseBiome getBiome(Vector2D position) {
|
||||
public BaseBiome getBiome(BlockVector2 position) {
|
||||
int x = position.getBlockX() - mx;
|
||||
int z = position.getBlockZ() - mz;
|
||||
return IMP.getBiome(x, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(Vector2D position, BaseBiome biome) {
|
||||
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
||||
int x = position.getBlockX() - mx;
|
||||
int z = position.getBlockZ() - mz;
|
||||
IMP.setBiome(x, z, biome.getId());
|
||||
return true;
|
||||
=======
|
||||
public BaseBiome getBiome(BlockVector2 position) {
|
||||
return new BaseBiome(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(BlockVector2 position, BaseBiome biome) {
|
||||
return false;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@ -345,17 +312,11 @@ public class BlockArrayClipboard implements Clipboard, LightingExtent, Closeable
|
||||
|
||||
@Override
|
||||
public int getOpacity(int x, int y, int z) {
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
mutable.mutZ(z);
|
||||
return getBlock(mutable).getBlockType().getMaterial().getLightOpacity();
|
||||
return getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().getLightOpacity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBrightness(int x, int y, int z) {
|
||||
mutable.mutX(x);
|
||||
mutable.mutY(y);
|
||||
mutable.mutZ(z);
|
||||
return getBlock(mutable).getBlockType().getMaterial().getLightValue();
|
||||
return getBlock(new BlockVector3(x, y, z)).getBlockType().getMaterial().getLightValue();
|
||||
}
|
||||
}
|
@ -38,12 +38,12 @@ import com.google.gson.Gson;
|
||||
import com.sk89q.jnbt.*;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.session.ClipboardHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
@ -304,7 +304,7 @@ public enum ClipboardFormat {
|
||||
// summary
|
||||
// blocks
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
Vector dimensions = clipboard.getDimensions();
|
||||
BlockVector3 dimensions = clipboard.getDimensions();
|
||||
map.put("width", dimensions.getX());
|
||||
map.put("height", dimensions.getY());
|
||||
map.put("length", dimensions.getZ());
|
||||
|
@ -31,6 +31,7 @@ import com.sk89q.jnbt.ShortTag;
|
||||
import com.sk89q.jnbt.StringTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
@ -225,7 +226,7 @@ public class MCEditSchematicReader extends NBTSchematicReader {
|
||||
try {
|
||||
if (state != null) {
|
||||
if (tileEntitiesMap.containsKey(pt)) {
|
||||
clipboard.setBlock(region.getMinimumPoint().add(pt), state.toBaseBlock(new CompoundTag(tileEntitiesMap.get(pt))));
|
||||
clipboard.setBlock(region.getMinimumPoint().add(pt), /*state.toBaseBlock(new CompoundTag(tileEntitiesMap.get(pt)))*/new BaseBlock(state, new CompoundTag(tileEntitiesMap.get(pt))));
|
||||
} else {
|
||||
clipboard.setBlock(region.getMinimumPoint().add(pt), state);
|
||||
}
|
||||
|
@ -42,12 +42,7 @@ import com.sk89q.jnbt.NamedTag;
|
||||
import com.sk89q.jnbt.ShortTag;
|
||||
import com.sk89q.jnbt.StringTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.entity.BaseEntity;
|
||||
@ -108,68 +103,214 @@ public class SpongeSchematicReader extends NBTSchematicReader {
|
||||
return read(UUID.randomUUID());
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
@Override
|
||||
public Clipboard read(UUID uuid) throws IOException {
|
||||
return readVersion1(uuid);
|
||||
}
|
||||
=======
|
||||
private Clipboard readVersion1(Map<String, Tag> schematic) throws IOException {
|
||||
BlockVector3 origin;
|
||||
Region region;
|
||||
|
||||
Map<String, Tag> metadata = requireTag(schematic, "Metadata", CompoundTag.class).getValue();
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
// private Clipboard readVersion1(Map<String, Tag> schematic) throws IOException {
|
||||
// BlockVector3 origin;
|
||||
// Region region;
|
||||
//
|
||||
// Map<String, Tag> metadata = requireTag(schematic, "Metadata", CompoundTag.class).getValue();
|
||||
// }
|
||||
private int width, height, length;
|
||||
private int offsetX, offsetY, offsetZ;
|
||||
private char[] palette;
|
||||
private Vector min;
|
||||
private BlockVector3 min;
|
||||
private FaweClipboard fc;
|
||||
|
||||
private FaweClipboard setupClipboard(int size, UUID uuid) {
|
||||
if (fc != null) {
|
||||
if (fc.getDimensions().getX() == 0) {
|
||||
fc.setDimensions(new Vector(size, 1, 1));
|
||||
fc.setDimensions(new BlockVector3(size, 1, 1));
|
||||
}
|
||||
return fc;
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
if (Settings.IMP.CLIPBOARD.USE_DISK) {
|
||||
return fc = new DiskOptimizedClipboard(size, 1, 1, uuid);
|
||||
} else if (Settings.IMP.CLIPBOARD.COMPRESSION_LEVEL == 0) {
|
||||
return fc = new CPUOptimizedClipboard(size, 1, 1);
|
||||
} else {
|
||||
return fc = new MemoryOptimizedClipboard(size, 1, 1);
|
||||
=======
|
||||
|
||||
BlockVector3 min = new BlockVector3(offsetParts[0], offsetParts[1], offsetParts[2]);
|
||||
|
||||
if (metadata.containsKey("WEOffsetX")) {
|
||||
// We appear to have WorldEdit Metadata
|
||||
int offsetX = requireTag(metadata, "WEOffsetX", IntTag.class).getValue();
|
||||
int offsetY = requireTag(metadata, "WEOffsetY", IntTag.class).getValue();
|
||||
int offsetZ = requireTag(metadata, "WEOffsetZ", IntTag.class).getValue();
|
||||
BlockVector3 offset = new BlockVector3(offsetX, offsetY, offsetZ);
|
||||
origin = min.subtract(offset);
|
||||
region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE));
|
||||
} else {
|
||||
origin = min;
|
||||
region = new CuboidRegion(origin, origin.add(width, height, length).subtract(BlockVector3.ONE));
|
||||
}
|
||||
|
||||
int paletteMax = requireTag(schematic, "PaletteMax", IntTag.class).getValue();
|
||||
Map<String, Tag> paletteObject = requireTag(schematic, "Palette", CompoundTag.class).getValue();
|
||||
if (paletteObject.size() != paletteMax) {
|
||||
throw new IOException("Differing given palette size to actual size");
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
}
|
||||
// BlockVector3 min = new BlockVector3(offsetParts[0], offsetParts[1], offsetParts[2]);
|
||||
//
|
||||
// if (metadata.containsKey("WEOffsetX")) {
|
||||
// // We appear to have WorldEdit Metadata
|
||||
// int offsetX = requireTag(metadata, "WEOffsetX", IntTag.class).getValue();
|
||||
// int offsetY = requireTag(metadata, "WEOffsetY", IntTag.class).getValue();
|
||||
// int offsetZ = requireTag(metadata, "WEOffsetZ", IntTag.class).getValue();
|
||||
// BlockVector3 offset = new BlockVector3(offsetX, offsetY, offsetZ);
|
||||
// origin = min.subtract(offset);
|
||||
// region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE));
|
||||
// } else {
|
||||
// origin = min;
|
||||
// region = new CuboidRegion(origin, origin.add(width, height, length).subtract(BlockVector3.ONE));
|
||||
// }
|
||||
//
|
||||
// int paletteMax = requireTag(schematic, "PaletteMax", IntTag.class).getValue();
|
||||
// Map<String, Tag> paletteObject = requireTag(schematic, "Palette", CompoundTag.class).getValue();
|
||||
// if (paletteObject.size() != paletteMax) {
|
||||
// throw new IOException("Differing given palette size to actual size");
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
// private Clipboard readVersion1(UUID uuid) throws IOException {
|
||||
// width = height = length = offsetX = offsetY = offsetZ = Integer.MIN_VALUE;
|
||||
//
|
||||
// final BlockArrayClipboard clipboard = new BlockArrayClipboard(new CuboidRegion(new Vector(0, 0, 0), new Vector(0, 0, 0)), fc);
|
||||
// FastByteArrayOutputStream blocksOut = new FastByteArrayOutputStream();
|
||||
// FastByteArrayOutputStream biomesOut = new FastByteArrayOutputStream();
|
||||
//
|
||||
// NBTStreamer streamer = new NBTStreamer(inputStream);
|
||||
// streamer.addReader("Schematic.Width", (BiConsumer<Integer, Short>) (i, v) -> width = v);
|
||||
// streamer.addReader("Schematic.Height", (BiConsumer<Integer, Short>) (i, v) -> height = v);
|
||||
// streamer.addReader("Schematic.Length", (BiConsumer<Integer, Short>) (i, v) -> length = v);
|
||||
// streamer.addReader("Schematic.Offset", (BiConsumer<Integer, int[]>) (i, v) -> min = new BlockVector(v[0], v[1], v[2]));
|
||||
// streamer.addReader("Schematic.Metadata.WEOffsetX", (BiConsumer<Integer, Integer>) (i, v) -> offsetX = v);
|
||||
// streamer.addReader("Schematic.Metadata.WEOffsetY", (BiConsumer<Integer, Integer>) (i, v) -> offsetY = v);
|
||||
// streamer.addReader("Schematic.Metadata.WEOffsetZ", (BiConsumer<Integer, Integer>) (i, v) -> offsetZ = v);
|
||||
// streamer.addReader("Schematic.Palette", (BiConsumer<Integer, HashMap<String, Tag>>) (i, v) -> {
|
||||
// palette = new char[v.size()];
|
||||
// for (Map.Entry<String, Tag> entry : v.entrySet()) {
|
||||
// BlockState state = BlockState.get(entry.getKey());
|
||||
// int index = ((IntTag) entry.getValue()).getValue();
|
||||
// palette[index] = (char) state.getOrdinal();
|
||||
// }
|
||||
//<<<<<<< HEAD
|
||||
// });
|
||||
// streamer.addReader("Schematic.BlockData.#", new NBTStreamer.LazyReader() {
|
||||
// @Override
|
||||
// public void accept(Integer arrayLen, DataInputStream dis) {
|
||||
// try (FaweOutputStream blocks = new FaweOutputStream(new LZ4BlockOutputStream(blocksOut))) {
|
||||
// IOUtil.copy(dis, blocks, arrayLen);
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
//=======
|
||||
// palette.put(id, state);
|
||||
// }
|
||||
//
|
||||
// byte[] blocks = requireTag(schematic, "BlockData", ByteArrayTag.class).getValue();
|
||||
//
|
||||
// Map<BlockVector3, Map<String, Tag>> tileEntitiesMap = new HashMap<>();
|
||||
// try {
|
||||
// List<Map<String, Tag>> tileEntityTags = requireTag(schematic, "TileEntities", ListTag.class).getValue().stream()
|
||||
// .map(tag -> (CompoundTag) tag)
|
||||
// .map(CompoundTag::getValue)
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// for (Map<String, Tag> tileEntity : tileEntityTags) {
|
||||
// int[] pos = requireTag(tileEntity, "Pos", IntArrayTag.class).getValue();
|
||||
// tileEntitiesMap.put(new BlockVector3(pos[0], pos[1], pos[2]), tileEntity);
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
// }
|
||||
// });
|
||||
// streamer.addReader("Schematic.Biomes.#", new NBTStreamer.LazyReader() {
|
||||
// @Override
|
||||
// public void accept(Integer arrayLen, DataInputStream dis) {
|
||||
// try (FaweOutputStream biomes = new FaweOutputStream(new LZ4BlockOutputStream(biomesOut))) {
|
||||
// IOUtil.copy(dis, biomes, arrayLen);
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// streamer.addReader("Schematic.TileEntities.#", new BiConsumer<Integer, CompoundTag>() {
|
||||
// @Override
|
||||
// public void accept(Integer index, CompoundTag value) {
|
||||
// if (fc == null) {
|
||||
// setupClipboard(0, uuid);
|
||||
// }
|
||||
// int[] pos = value.getIntArray("Pos");
|
||||
// int x = pos[0];
|
||||
// int y = pos[1];
|
||||
// int z = pos[2];
|
||||
// fc.setTile(x, y, z, value);
|
||||
// }
|
||||
// });
|
||||
// streamer.addReader("Schematic.Entities.#", new BiConsumer<Integer, CompoundTag>() {
|
||||
// @Override
|
||||
// public void accept(Integer index, CompoundTag compound) {
|
||||
// if (fc == null) {
|
||||
// setupClipboard(0, uuid);
|
||||
// }
|
||||
// String id = compound.getString("id");
|
||||
// if (id.isEmpty()) {
|
||||
// return;
|
||||
// }
|
||||
// ListTag positionTag = compound.getListTag("Pos");
|
||||
// ListTag directionTag = compound.getListTag("Rotation");
|
||||
// EntityType type = EntityTypes.parse(id);
|
||||
// if (type != null) {
|
||||
// compound.getValue().put("Id", new StringTag(type.getId()));
|
||||
// BaseEntity state = new BaseEntity(type, compound);
|
||||
// fc.createEntity(clipboard, positionTag.asDouble(0), positionTag.asDouble(1), positionTag.asDouble(2), (float) directionTag.asDouble(0), (float) directionTag.asDouble(1), state);
|
||||
// } else {
|
||||
// Fawe.debug("Invalid entity: " + id);
|
||||
// }
|
||||
// }
|
||||
//<<<<<<< HEAD
|
||||
// });
|
||||
// streamer.readFully();
|
||||
// if (fc == null) setupClipboard(length * width * height, uuid);
|
||||
// Vector origin = min;
|
||||
// CuboidRegion region;
|
||||
// if (offsetX != Integer.MIN_VALUE && offsetY != Integer.MIN_VALUE && offsetZ != Integer.MIN_VALUE) {
|
||||
// origin = origin.subtract(new Vector(offsetX, offsetY, offsetZ));
|
||||
// region = new CuboidRegion(min, min.add(width, height, length).subtract(Vector.ONE));
|
||||
// } else {
|
||||
// region = new CuboidRegion(min, min.add(width, height, length).subtract(Vector.ONE));
|
||||
// }
|
||||
// if (blocksOut.getSize() != 0) {
|
||||
// try (FaweInputStream fis = new FaweInputStream(new LZ4BlockInputStream(new FastByteArraysInputStream(blocksOut.toByteArrays())))) {
|
||||
// int volume = width * height * length;
|
||||
// if (palette.length < 128) {
|
||||
// for (int index = 0; index < volume; index++) {
|
||||
// BlockState state = BlockTypes.states[palette[fis.read()]];
|
||||
// fc.setBlock(index, state);
|
||||
//=======
|
||||
// // index = (y * length + z) * width + x
|
||||
// int y = index / (width * length);
|
||||
// int z = (index % (width * length)) / width;
|
||||
// int x = (index % (width * length)) % width;
|
||||
// BlockState state = palette.get(value);
|
||||
// BlockVector3 pt = new BlockVector3(x, y, z);
|
||||
// try {
|
||||
// if (tileEntitiesMap.containsKey(pt)) {
|
||||
// Map<String, Tag> values = Maps.newHashMap(tileEntitiesMap.get(pt));
|
||||
// for (NBTCompatibilityHandler handler : COMPATIBILITY_HANDLERS) {
|
||||
// if (handler.isAffectedBlock(state)) {
|
||||
// handler.updateNBT(state, values);
|
||||
// }
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
// }
|
||||
// } else {
|
||||
// for (int index = 0; index < volume; index++) {
|
||||
// BlockState state = BlockTypes.states[palette[fis.readVarInt()]];
|
||||
// fc.setBlock(index, state);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (biomesOut.getSize() != 0) {
|
||||
// try (FaweInputStream fis = new FaweInputStream(new LZ4BlockInputStream(new FastByteArraysInputStream(biomesOut.toByteArrays())))) {
|
||||
// int volume = width * length;
|
||||
// for (int index = 0; index < volume; index++) {
|
||||
// fc.setBiome(index, fis.read());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// fc.setDimensions(new Vector(width, height, length));
|
||||
// clipboard.init(region, fc);
|
||||
// clipboard.setOrigin(origin);
|
||||
// return clipboard;
|
||||
// }
|
||||
|
||||
private Clipboard readVersion1(UUID uuid) throws IOException {
|
||||
width = height = length = offsetX = offsetY = offsetZ = Integer.MIN_VALUE;
|
||||
|
||||
final BlockArrayClipboard clipboard = new BlockArrayClipboard(new CuboidRegion(new Vector(0, 0, 0), new Vector(0, 0, 0)), fc);
|
||||
final BlockArrayClipboard clipboard = new BlockArrayClipboard(new CuboidRegion(new BlockVector3(0, 0, 0), new BlockVector3(0, 0, 0)), fc);
|
||||
FastByteArrayOutputStream blocksOut = new FastByteArrayOutputStream();
|
||||
FastByteArrayOutputStream biomesOut = new FastByteArrayOutputStream();
|
||||
|
||||
@ -177,7 +318,7 @@ public class SpongeSchematicReader extends NBTSchematicReader {
|
||||
streamer.addReader("Schematic.Width", (BiConsumer<Integer, Short>) (i, v) -> width = v);
|
||||
streamer.addReader("Schematic.Height", (BiConsumer<Integer, Short>) (i, v) -> height = v);
|
||||
streamer.addReader("Schematic.Length", (BiConsumer<Integer, Short>) (i, v) -> length = v);
|
||||
streamer.addReader("Schematic.Offset", (BiConsumer<Integer, int[]>) (i, v) -> min = new BlockVector(v[0], v[1], v[2]));
|
||||
streamer.addReader("Schematic.Offset", (BiConsumer<Integer, int[]>) (i, v) -> min = new BlockVector3(v[0], v[1], v[2]));
|
||||
streamer.addReader("Schematic.Metadata.WEOffsetX", (BiConsumer<Integer, Integer>) (i, v) -> offsetX = v);
|
||||
streamer.addReader("Schematic.Metadata.WEOffsetY", (BiConsumer<Integer, Integer>) (i, v) -> offsetY = v);
|
||||
streamer.addReader("Schematic.Metadata.WEOffsetZ", (BiConsumer<Integer, Integer>) (i, v) -> offsetZ = v);
|
||||
@ -188,7 +329,6 @@ public class SpongeSchematicReader extends NBTSchematicReader {
|
||||
int index = ((IntTag) entry.getValue()).getValue();
|
||||
palette[index] = (char) state.getOrdinal();
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
});
|
||||
streamer.addReader("Schematic.BlockData.#", new NBTStreamer.LazyReader() {
|
||||
@Override
|
||||
@ -198,23 +338,6 @@ public class SpongeSchematicReader extends NBTSchematicReader {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
=======
|
||||
palette.put(id, state);
|
||||
}
|
||||
|
||||
byte[] blocks = requireTag(schematic, "BlockData", ByteArrayTag.class).getValue();
|
||||
|
||||
Map<BlockVector3, Map<String, Tag>> tileEntitiesMap = new HashMap<>();
|
||||
try {
|
||||
List<Map<String, Tag>> tileEntityTags = requireTag(schematic, "TileEntities", ListTag.class).getValue().stream()
|
||||
.map(tag -> (CompoundTag) tag)
|
||||
.map(CompoundTag::getValue)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (Map<String, Tag> tileEntity : tileEntityTags) {
|
||||
int[] pos = requireTag(tileEntity, "Pos", IntArrayTag.class).getValue();
|
||||
tileEntitiesMap.put(new BlockVector3(pos[0], pos[1], pos[2]), tileEntity);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
});
|
||||
streamer.addReader("Schematic.Biomes.#", new NBTStreamer.LazyReader() {
|
||||
@ -261,17 +384,16 @@ public class SpongeSchematicReader extends NBTSchematicReader {
|
||||
Fawe.debug("Invalid entity: " + id);
|
||||
}
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
});
|
||||
streamer.readFully();
|
||||
if (fc == null) setupClipboard(length * width * height, uuid);
|
||||
Vector origin = min;
|
||||
BlockVector3 origin = min;
|
||||
CuboidRegion region;
|
||||
if (offsetX != Integer.MIN_VALUE && offsetY != Integer.MIN_VALUE && offsetZ != Integer.MIN_VALUE) {
|
||||
origin = origin.subtract(new Vector(offsetX, offsetY, offsetZ));
|
||||
region = new CuboidRegion(min, min.add(width, height, length).subtract(Vector.ONE));
|
||||
origin = origin.subtract(new BlockVector3(offsetX, offsetY, offsetZ));
|
||||
region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE));
|
||||
} else {
|
||||
region = new CuboidRegion(min, min.add(width, height, length).subtract(Vector.ONE));
|
||||
region = new CuboidRegion(min, min.add(width, height, length).subtract(BlockVector3.ONE));
|
||||
}
|
||||
if (blocksOut.getSize() != 0) {
|
||||
try (FaweInputStream fis = new FaweInputStream(new LZ4BlockInputStream(new FastByteArraysInputStream(blocksOut.toByteArrays())))) {
|
||||
@ -280,21 +402,6 @@ public class SpongeSchematicReader extends NBTSchematicReader {
|
||||
for (int index = 0; index < volume; index++) {
|
||||
BlockState state = BlockTypes.states[palette[fis.read()]];
|
||||
fc.setBlock(index, state);
|
||||
=======
|
||||
// index = (y * length + z) * width + x
|
||||
int y = index / (width * length);
|
||||
int z = (index % (width * length)) / width;
|
||||
int x = (index % (width * length)) % width;
|
||||
BlockState state = palette.get(value);
|
||||
BlockVector3 pt = new BlockVector3(x, y, z);
|
||||
try {
|
||||
if (tileEntitiesMap.containsKey(pt)) {
|
||||
Map<String, Tag> values = Maps.newHashMap(tileEntitiesMap.get(pt));
|
||||
for (NBTCompatibilityHandler handler : COMPATIBILITY_HANDLERS) {
|
||||
if (handler.isAffectedBlock(state)) {
|
||||
handler.updateNBT(state, values);
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
} else {
|
||||
for (int index = 0; index < volume; index++) {
|
||||
@ -312,12 +419,13 @@ public class SpongeSchematicReader extends NBTSchematicReader {
|
||||
}
|
||||
}
|
||||
}
|
||||
fc.setDimensions(new Vector(width, height, length));
|
||||
fc.setDimensions(new BlockVector3(width, height, length));
|
||||
clipboard.init(region, fc);
|
||||
clipboard.setOrigin(origin);
|
||||
return clipboard;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
inputStream.close();
|
||||
|
@ -27,23 +27,14 @@ import com.sk89q.jnbt.NBTConstants;
|
||||
import com.sk89q.jnbt.NBTOutputStream;
|
||||
import com.sk89q.jnbt.StringTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard;
|
||||
=======
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.extent.clipboard.Clipboard;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import net.jpountz.lz4.LZ4BlockInputStream;
|
||||
import net.jpountz.lz4.LZ4BlockOutputStream;
|
||||
=======
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@ -83,15 +74,9 @@ public class SpongeSchematicWriter implements ClipboardWriter {
|
||||
public void write1(Clipboard clipboard) throws IOException {
|
||||
// metadata
|
||||
Region region = clipboard.getRegion();
|
||||
<<<<<<< HEAD
|
||||
Vector origin = clipboard.getOrigin();
|
||||
BlockVector min = region.getMinimumPoint().toBlockVector();
|
||||
Vector offset = min.subtract(origin);
|
||||
=======
|
||||
BlockVector3 origin = clipboard.getOrigin();
|
||||
BlockVector3 min = region.getMinimumPoint();
|
||||
BlockVector3 offset = min.subtract(origin);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
int width = region.getWidth();
|
||||
int height = region.getHeight();
|
||||
int length = region.getLength();
|
||||
@ -104,7 +89,7 @@ public class SpongeSchematicWriter implements ClipboardWriter {
|
||||
if (length > MAX_SIZE) {
|
||||
throw new IllegalArgumentException("Length of region too large for a .schematic");
|
||||
}
|
||||
<<<<<<< HEAD
|
||||
//<<<<<<< HEAD
|
||||
// output
|
||||
final DataOutput rawStream = outputStream.getOutputStream();
|
||||
outputStream.writeLazyCompoundTag("Schematic", out -> {
|
||||
@ -157,49 +142,49 @@ public class SpongeSchematicWriter implements ClipboardWriter {
|
||||
}));
|
||||
numTiles[0]++;
|
||||
tilesOut.writeTagPayload(tile);
|
||||
=======
|
||||
|
||||
Map<String, Tag> schematic = new HashMap<>();
|
||||
schematic.put("Version", new IntTag(1));
|
||||
|
||||
Map<String, Tag> metadata = new HashMap<>();
|
||||
metadata.put("WEOffsetX", new IntTag(offset.getBlockX()));
|
||||
metadata.put("WEOffsetY", new IntTag(offset.getBlockY()));
|
||||
metadata.put("WEOffsetZ", new IntTag(offset.getBlockZ()));
|
||||
|
||||
schematic.put("Metadata", new CompoundTag(metadata));
|
||||
|
||||
schematic.put("Width", new ShortTag((short) width));
|
||||
schematic.put("Height", new ShortTag((short) height));
|
||||
schematic.put("Length", new ShortTag((short) length));
|
||||
|
||||
// The Sponge format Offset refers to the 'min' points location in the world. That's our 'Origin'
|
||||
schematic.put("Offset", new IntArrayTag(new int[]{
|
||||
min.getBlockX(),
|
||||
min.getBlockY(),
|
||||
min.getBlockZ(),
|
||||
}));
|
||||
|
||||
int paletteMax = 0;
|
||||
Map<String, Integer> palette = new HashMap<>();
|
||||
|
||||
List<CompoundTag> tileEntities = new ArrayList<>();
|
||||
|
||||
ByteArrayOutputStream buffer = new ByteArrayOutputStream(width * height * length);
|
||||
|
||||
for (int y = 0; y < height; y++) {
|
||||
int y0 = min.getBlockY() + y;
|
||||
for (int z = 0; z < length; z++) {
|
||||
int z0 = min.getBlockZ() + z;
|
||||
for (int x = 0; x < width; x++) {
|
||||
int x0 = min.getBlockX() + x;
|
||||
BlockVector3 point = new BlockVector3(x0, y0, z0);
|
||||
BaseBlock block = clipboard.getFullBlock(point);
|
||||
if (block.getNbtData() != null) {
|
||||
Map<String, Tag> values = new HashMap<>();
|
||||
for (Map.Entry<String, Tag> entry : block.getNbtData().getValue().entrySet()) {
|
||||
values.put(entry.getKey(), entry.getValue());
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
//
|
||||
// Map<String, Tag> schematic = new HashMap<>();
|
||||
// schematic.put("Version", new IntTag(1));
|
||||
//
|
||||
// Map<String, Tag> metadata = new HashMap<>();
|
||||
// metadata.put("WEOffsetX", new IntTag(offset.getBlockX()));
|
||||
// metadata.put("WEOffsetY", new IntTag(offset.getBlockY()));
|
||||
// metadata.put("WEOffsetZ", new IntTag(offset.getBlockZ()));
|
||||
//
|
||||
// schematic.put("Metadata", new CompoundTag(metadata));
|
||||
//
|
||||
// schematic.put("Width", new ShortTag((short) width));
|
||||
// schematic.put("Height", new ShortTag((short) height));
|
||||
// schematic.put("Length", new ShortTag((short) length));
|
||||
//
|
||||
// // The Sponge format Offset refers to the 'min' points location in the world. That's our 'Origin'
|
||||
// schematic.put("Offset", new IntArrayTag(new int[]{
|
||||
// min.getBlockX(),
|
||||
// min.getBlockY(),
|
||||
// min.getBlockZ(),
|
||||
// }));
|
||||
//
|
||||
// int paletteMax = 0;
|
||||
// Map<String, Integer> palette = new HashMap<>();
|
||||
//
|
||||
// List<CompoundTag> tileEntities = new ArrayList<>();
|
||||
//
|
||||
// ByteArrayOutputStream buffer = new ByteArrayOutputStream(width * height * length);
|
||||
//
|
||||
// for (int y = 0; y < height; y++) {
|
||||
// int y0 = min.getBlockY() + y;
|
||||
// for (int z = 0; z < length; z++) {
|
||||
// int z0 = min.getBlockZ() + z;
|
||||
// for (int x = 0; x < width; x++) {
|
||||
// int x0 = min.getBlockX() + x;
|
||||
// BlockVector3 point = new BlockVector3(x0, y0, z0);
|
||||
// BaseBlock block = clipboard.getFullBlock(point);
|
||||
// if (block.getNbtData() != null) {
|
||||
// Map<String, Tag> values = new HashMap<>();
|
||||
// for (Map.Entry<String, Tag> entry : block.getNbtData().getValue().entrySet()) {
|
||||
// values.put(entry.getKey(), entry.getValue());
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
}
|
||||
int ordinal = block.getOrdinal();
|
||||
char value = palette[ordinal];
|
||||
@ -221,7 +206,7 @@ public class SpongeSchematicWriter implements ClipboardWriter {
|
||||
if (clipboard instanceof BlockArrayClipboard) {
|
||||
((BlockArrayClipboard) clipboard).IMP.forEach(reader, true);
|
||||
} else {
|
||||
for (Vector pt : region) {
|
||||
for (BlockVector3 pt : region) {
|
||||
BlockState block = clipboard.getBlock(pt);
|
||||
int x = pt.getBlockX() - min.getBlockX();
|
||||
int y = pt.getBlockY() - min.getBlockY();
|
||||
|
@ -1,18 +1,14 @@
|
||||
package com.sk89q.worldedit.extent.inventory;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.object.exception.FaweException;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
=======
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -90,15 +86,15 @@ public class BlockBagExtent extends AbstractDelegateExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
<<<<<<< HEAD
|
||||
public boolean setBlock(Vector pos, BlockStateHolder block) throws WorldEditException {
|
||||
//<<<<<<< HEAD
|
||||
public boolean setBlock(BlockVector3 pos, BlockStateHolder block) throws WorldEditException {
|
||||
return setBlock(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ(), block);
|
||||
}
|
||||
=======
|
||||
public boolean setBlock(BlockVector3 position, BlockStateHolder block) throws WorldEditException {
|
||||
if (blockBag != null) {
|
||||
BlockState existing = getExtent().getBlock(position);
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
//=======
|
||||
// public boolean setBlock(BlockVector3 position, BlockStateHolder block) throws WorldEditException {
|
||||
// if (blockBag != null) {
|
||||
// BlockState existing = getExtent().getBlock(position);
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
@Override
|
||||
public boolean setBlock(int x, int y, int z, BlockStateHolder block) throws WorldEditException {
|
||||
|
@ -19,11 +19,11 @@
|
||||
|
||||
package com.sk89q.worldedit.extent.logging;
|
||||
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
@ -47,11 +47,11 @@ public abstract class AbstractLoggingExtent extends AbstractDelegateExtent {
|
||||
* @param position the position
|
||||
* @param newBlock the new block to replace the old one
|
||||
*/
|
||||
protected void onBlockChange(Vector position, BlockStateHolder newBlock) {
|
||||
protected void onBlockChange(BlockVector3 position, BlockStateHolder newBlock) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean setBlock(Vector position, BlockStateHolder block) throws WorldEditException {
|
||||
public final boolean setBlock(BlockVector3 position, BlockStateHolder block) throws WorldEditException {
|
||||
onBlockChange(position, block);
|
||||
return super.setBlock(position, block);
|
||||
}
|
||||
|
@ -19,13 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.extent.reorder;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.google.common.collect.Iterators;
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import com.google.common.collect.Iterables;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.Blocks;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
@ -34,11 +29,8 @@ import com.sk89q.worldedit.function.operation.BlockMapEntryPlacer;
|
||||
import com.sk89q.worldedit.function.operation.Operation;
|
||||
import com.sk89q.worldedit.function.operation.OperationQueue;
|
||||
import com.sk89q.worldedit.function.operation.RunContext;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import com.sk89q.worldedit.function.operation.SetLocatedBlocks;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
import com.sk89q.worldedit.util.collection.TupleArrayList;
|
||||
import com.sk89q.worldedit.world.block.BlockCategories;
|
||||
|
@ -1,13 +1,10 @@
|
||||
package com.sk89q.worldedit.extent.transform;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.boydti.fawe.object.extent.ResettableExtent;
|
||||
import com.boydti.fawe.util.ReflectionUtils;
|
||||
import com.sk89q.jnbt.ByteTag;
|
||||
import com.sk89q.jnbt.CompoundTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.Vector2D;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseBlock;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
@ -15,25 +12,20 @@ import com.sk89q.worldedit.internal.helper.MCDirections;
|
||||
import com.sk89q.worldedit.math.transform.AffineTransform;
|
||||
import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.registry.state.AbstractProperty;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.math.transform.Transform;
|
||||
import com.sk89q.worldedit.registry.state.BooleanProperty;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.registry.state.DirectionalProperty;
|
||||
import com.sk89q.worldedit.util.Direction;
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.world.biome.BaseBiome;
|
||||
=======
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -43,6 +35,7 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Transforms blocks themselves (but not their position) according to a
|
||||
@ -77,71 +70,12 @@ public class BlockTransformExtent extends ResettableExtent {
|
||||
|
||||
case ROTATION:
|
||||
|
||||
<<<<<<< HEAD
|
||||
case AXIS:
|
||||
|
||||
case FACING:
|
||||
|
||||
case SHAPE:
|
||||
=======
|
||||
@Override
|
||||
public BlockState getBlock(BlockVector3 position) {
|
||||
return transformBlock(super.getBlock(position), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBlock getFullBlock(BlockVector3 position) {
|
||||
return transformBlock(super.getFullBlock(position), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException {
|
||||
return super.setBlock(location, transformBlock(block, true));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Transform the given block using the given transform.
|
||||
*
|
||||
* <p>The provided block is modified.</p>
|
||||
*
|
||||
* @param block the block
|
||||
* @param transform the transform
|
||||
* @return the same block
|
||||
*/
|
||||
public static <T extends BlockStateHolder> T transform(T block, Transform transform) {
|
||||
return transform(block, transform, block);
|
||||
}
|
||||
|
||||
private static final Set<String> directionNames = Sets.newHashSet("north", "south", "east", "west");
|
||||
|
||||
/**
|
||||
* Transform the given block using the given transform.
|
||||
*
|
||||
* @param block the block
|
||||
* @param transform the transform
|
||||
* @param changedBlock the block to change
|
||||
* @return the changed block
|
||||
*/
|
||||
private static <T extends BlockStateHolder> T transform(T block, Transform transform, T changedBlock) {
|
||||
checkNotNull(block);
|
||||
checkNotNull(transform);
|
||||
|
||||
List<? extends Property> properties = block.getBlockType().getProperties();
|
||||
|
||||
for (Property property : properties) {
|
||||
if (property instanceof DirectionalProperty) {
|
||||
Direction value = (Direction) block.getState(property);
|
||||
if (value != null) {
|
||||
Vector3 newValue = getNewStateValue((DirectionalProperty) property, transform, value.toVector());
|
||||
if (newValue != null) {
|
||||
changedBlock = (T) changedBlock.with(property, Direction.findClosest(newValue, Direction.Flag.ALL));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
|
||||
case NORTH:
|
||||
case EAST:
|
||||
case SOUTH:
|
||||
@ -150,21 +84,79 @@ public class BlockTransformExtent extends ResettableExtent {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
// @Override
|
||||
// public BlockState getBlock(BlockVector3 position) {
|
||||
// return transformBlock(super.getBlock(position), false);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public BaseBlock getFullBlock(BlockVector3 position) {
|
||||
// return transformBlock(super.getFullBlock(position), false);
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException {
|
||||
// return super.setBlock(location, transformBlock(block, true));
|
||||
// }
|
||||
|
||||
|
||||
// /**
|
||||
// * Transform the given block using the given transform.
|
||||
// *
|
||||
// * <p>The provided block is modified.</p>
|
||||
// *
|
||||
// * @param block the block
|
||||
// * @param transform the transform
|
||||
// * @return the same block
|
||||
// */
|
||||
// public static <T extends BlockStateHolder> T transform(T block, Transform transform) {
|
||||
// return transform(block, transform, block);
|
||||
// }
|
||||
|
||||
private static final Set<String> directionNames = Sets.newHashSet("north", "south", "east", "west");
|
||||
|
||||
// /**
|
||||
// * Transform the given block using the given transform.
|
||||
// *
|
||||
// * @param block the block
|
||||
// * @param transform the transform
|
||||
// * @param changedBlock the block to change
|
||||
// * @return the changed block
|
||||
// */
|
||||
// private static <T extends BlockStateHolder> T transform(T block, Transform transform, T changedBlock) {
|
||||
// checkNotNull(block);
|
||||
// checkNotNull(transform);
|
||||
//
|
||||
// List<? extends Property> properties = block.getBlockType().getProperties();
|
||||
//
|
||||
// for (Property property : properties) {
|
||||
// if (property instanceof DirectionalProperty) {
|
||||
// Direction value = (Direction) block.getState(property);
|
||||
// if (value != null) {
|
||||
// Vector3 newValue = getNewStateValue((DirectionalProperty) property, transform, value.toVector());
|
||||
// if (newValue != null) {
|
||||
// changedBlock = (T) changedBlock.with(property, Direction.findClosest(newValue, Direction.Flag.ALL));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
@Nullable
|
||||
<<<<<<< HEAD
|
||||
//<<<<<<< HEAD
|
||||
private static Integer getNewStateIndex(Transform transform, List<Direction> directions, int oldIndex) {
|
||||
Direction oldDirection = directions.get(oldIndex);
|
||||
Vector oldVector = oldDirection.toVector();
|
||||
Vector newVector = transform.apply(oldVector).subtract(transform.apply(Vector.ZERO)).normalize();
|
||||
Vector3 oldVector = oldDirection.toVector();
|
||||
Vector3 newVector = transform.apply(oldVector).subtract(transform.apply(Vector3.ZERO)).normalize();
|
||||
int newIndex = oldIndex;
|
||||
double closest = oldVector.toVector().normalize().dot(newVector);
|
||||
=======
|
||||
private static Vector3 getNewStateValue(DirectionalProperty state, Transform transform, Vector3 oldDirection) {
|
||||
Vector3 newDirection = transform.apply(oldDirection).subtract(transform.apply(Vector3.ZERO)).normalize();
|
||||
Vector3 newValue = null;
|
||||
double closest = -2;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
double closest = oldVector.normalize().dot(newVector);
|
||||
//=======
|
||||
// private static Vector3 getNewStateValue(DirectionalProperty state, Transform transform, Vector3 oldDirection) {
|
||||
// Vector3 newDirection = transform.apply(oldDirection).subtract(transform.apply(Vector3.ZERO)).normalize();
|
||||
// Vector3 newValue = null;
|
||||
// double closest = -2;
|
||||
//>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
boolean found = false;
|
||||
|
||||
for (int i = 0; i < directions.size(); i++) {
|
||||
@ -265,13 +257,10 @@ public class BlockTransformExtent extends ResettableExtent {
|
||||
Direction direction = MCDirections.fromRotation(rot);
|
||||
|
||||
if (direction != null) {
|
||||
Vector applyAbsolute = transform.apply(direction.toVector());
|
||||
Vector applyOrigin = transform.apply(Vector.ZERO);
|
||||
applyAbsolute.mutX(applyAbsolute.getX() - applyOrigin.getX());
|
||||
applyAbsolute.mutY(applyAbsolute.getY() - applyOrigin.getY());
|
||||
applyAbsolute.mutZ(applyAbsolute.getZ() - applyOrigin.getZ());
|
||||
Vector3 applyAbsolute = transform.apply(direction.toVector());
|
||||
Vector3 applyOrigin = transform.apply(Vector3.ZERO);
|
||||
|
||||
Direction newDirection = Direction.findClosest(applyAbsolute, Direction.Flag.CARDINAL | Direction.Flag.ORDINAL | Direction.Flag.SECONDARY_ORDINAL);
|
||||
Direction newDirection = Direction.findClosest(applyAbsolute.subtract(applyOrigin), Direction.Flag.CARDINAL | Direction.Flag.ORDINAL | Direction.Flag.SECONDARY_ORDINAL);
|
||||
|
||||
if (newDirection != null) {
|
||||
Map<String, Tag> values = ReflectionUtils.getMap(tag.getValue());
|
||||
@ -294,13 +283,10 @@ public class BlockTransformExtent extends ResettableExtent {
|
||||
Direction direction = MCDirections.fromRotation(rot);
|
||||
|
||||
if (direction != null) {
|
||||
Vector applyAbsolute = transformInverse.apply(direction.toVector());
|
||||
Vector applyOrigin = transformInverse.apply(Vector.ZERO);
|
||||
applyAbsolute.mutX(applyAbsolute.getX() - applyOrigin.getX());
|
||||
applyAbsolute.mutY(applyAbsolute.getY() - applyOrigin.getY());
|
||||
applyAbsolute.mutZ(applyAbsolute.getZ() - applyOrigin.getZ());
|
||||
Vector3 applyAbsolute = transformInverse.apply(direction.toVector());
|
||||
Vector3 applyOrigin = transformInverse.apply(Vector3.ZERO);
|
||||
|
||||
Direction newDirection = Direction.findClosest(applyAbsolute, Direction.Flag.CARDINAL | Direction.Flag.ORDINAL | Direction.Flag.SECONDARY_ORDINAL);
|
||||
Direction newDirection = Direction.findClosest(applyAbsolute.subtract(applyOrigin), Direction.Flag.CARDINAL | Direction.Flag.ORDINAL | Direction.Flag.SECONDARY_ORDINAL);
|
||||
|
||||
if (newDirection != null) {
|
||||
Map<String, Tag> values = ReflectionUtils.getMap(tag.getValue());
|
||||
@ -319,17 +305,17 @@ public class BlockTransformExtent extends ResettableExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(Vector position) {
|
||||
public BlockState getLazyBlock(BlockVector3 position) {
|
||||
return transformFast(super.getLazyBlock(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(Vector position) {
|
||||
public BlockState getBlock(BlockVector3 position) {
|
||||
return transformFast(super.getBlock(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBiome getBiome(Vector2D position) {
|
||||
public BaseBiome getBiome(BlockVector2 position) {
|
||||
return super.getBiome(position);
|
||||
}
|
||||
|
||||
@ -340,7 +326,7 @@ public class BlockTransformExtent extends ResettableExtent {
|
||||
|
||||
|
||||
@Override
|
||||
public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException {
|
||||
public boolean setBlock(BlockVector3 location, BlockStateHolder block) throws WorldEditException {
|
||||
return super.setBlock(location, transformFastInverse((BlockState) block));
|
||||
}
|
||||
|
||||
|
@ -25,13 +25,10 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
<<<<<<< HEAD
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
=======
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
|
||||
/**
|
||||
* Limits the number of blocks that can be changed before a
|
||||
|
@ -19,12 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.extent.validation;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
|
@ -22,13 +22,10 @@ package com.sk89q.worldedit.extent.world;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
|
@ -19,12 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.extent.world;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
|
@ -19,13 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.extent.world;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.BlockVector2D;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
|
@ -19,13 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.extent.world;
|
||||
|
||||
<<<<<<< HEAD
|
||||
import com.sk89q.worldedit.MutableBlockVector;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
=======
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
>>>>>>> 399e0ad5... Refactor vector system to be cleaner
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
@ -98,7 +93,7 @@ public class SurvivalModeExtent extends AbstractDelegateExtent {
|
||||
@Override
|
||||
public boolean setBlock(int x, int y, int z, BlockStateHolder block) throws WorldEditException {
|
||||
if (toolUse && block.getBlockType().getMaterial().isAir()) {
|
||||
world.simulateBlockMine(MutableBlockVector.get(x, y, z));
|
||||
world.simulateBlockMine(new BlockVector3(x, y, z));
|
||||
return true;
|
||||
} else {
|
||||
return super.setBlock(x, y, z, block);
|
||||
|
Reference in New Issue
Block a user