mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-05 20:36:42 +00:00
.
This commit is contained in:
@ -52,17 +52,12 @@ public class BlockTranslateExtent extends AbstractDelegateExtent {
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(BlockVector3 location) {
|
||||
return getLazyBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
return getBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(BlockVector3 location) {
|
||||
return getLazyBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(int x, int y, int z) {
|
||||
return super.getLazyBlock(x + dx, y + dy, z + dz);
|
||||
public BlockState getBlock(int x, int y, int z) {
|
||||
return super.getBlock(x + dx, y + dy, z + dz);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -50,7 +50,7 @@ public class EmptyExtent implements Extent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(BlockVector3 position) {
|
||||
public BlockState getBlock(int x, int y, int z) {
|
||||
return EditSession.nullBlock;
|
||||
}
|
||||
|
||||
|
@ -112,8 +112,6 @@ public class FastWorldEditExtent extends AbstractDelegateExtent implements HasFa
|
||||
public <B extends BlockStateHolder<B>> boolean setBlock(final BlockVector3 location, final B block) throws WorldEditException {
|
||||
return setBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ(), block);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public <B extends BlockStateHolder<B>> boolean setBlock(int x, int y, int z, final B block) throws WorldEditException {
|
||||
@ -121,12 +119,12 @@ public class FastWorldEditExtent extends AbstractDelegateExtent implements HasFa
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(BlockVector3 location) {
|
||||
return getLazyBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
public BlockState getBlock(BlockVector3 location) {
|
||||
return getBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(int x, int y, int z) {
|
||||
public BlockState getBlock(int x, int y, int z) {
|
||||
int combinedId4Data = queue.getCombinedId4Data(x, y, z, 0);
|
||||
BlockType type = BlockTypes.getFromStateId(combinedId4Data);
|
||||
BlockState state = type.withStateId(combinedId4Data);
|
||||
@ -157,11 +155,6 @@ public class FastWorldEditExtent extends AbstractDelegateExtent implements HasFa
|
||||
return world.getEntities(region);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(final BlockVector3 position) {
|
||||
return this.getLazyBlock(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(final BlockVector2 position, final BiomeType biome) {
|
||||
queue.setBiome(position.getBlockX(), position.getBlockZ(), biome);
|
||||
|
@ -66,7 +66,7 @@ public class NullExtent extends FaweRegionExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(final BlockVector3 arg0) {
|
||||
public BlockState getBlock(int x, int y, int z) {
|
||||
if(reason != null) {
|
||||
throw new FaweException(reason);
|
||||
}else {
|
||||
@ -74,6 +74,15 @@ public class NullExtent extends FaweRegionExtent {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBlock getFullBlock(int x, int y, int z) {
|
||||
if(reason != null) {
|
||||
throw new FaweException(reason);
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(final BlockVector2 arg0, final BiomeType arg1) {
|
||||
if(reason != null) {
|
||||
@ -101,15 +110,6 @@ public class NullExtent extends FaweRegionExtent {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(int x, int y, int z) {
|
||||
if(reason != null) {
|
||||
throw new FaweException(reason);
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity createEntity(final Location arg0, final BaseEntity arg1) {
|
||||
if(reason != null) {
|
||||
|
@ -47,20 +47,15 @@ public class PositionTransformExtent extends ResettableExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(int x, int y, int z) {
|
||||
return super.getLazyBlock(getPos(BlockVector3.at(x, y, z)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(BlockVector3 position) {
|
||||
return super.getLazyBlock(getPos(position));
|
||||
public BlockState getBlock(int x, int y, int z) {
|
||||
return super.getBlock(getPos(BlockVector3.at(x, y, z)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(BlockVector3 position) {
|
||||
return super.getBlock(getPos(position));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BaseBlock getFullBlock(BlockVector3 position) {
|
||||
return super.getFullBlock(getPos(position));
|
||||
|
@ -63,12 +63,12 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(int x, int y, int z) {
|
||||
public BlockState getBlock(int x, int y, int z) {
|
||||
if (!limit.MAX_CHECKS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_MAX_CHECKS);
|
||||
return EditSession.nullBlock;
|
||||
} else {
|
||||
return extent.getLazyBlock(x, y, z);
|
||||
return extent.getBlock(x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,8 +88,8 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(BlockVector3 location) {
|
||||
return getLazyBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
public BlockState getBlock(BlockVector3 location) {
|
||||
return getBlock(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -58,19 +58,11 @@ public class TemporalExtent extends AbstractDelegateExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(BlockVector3 position) {
|
||||
if (position.getX() == x && position.getY() == y && position.getZ() == z) {
|
||||
return block.toImmutableState();
|
||||
}
|
||||
return super.getLazyBlock(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(int x, int y, int z) {
|
||||
public BlockState getBlock(int x, int y, int z) {
|
||||
if (this.x == x && this.y == y && this.z == z) {
|
||||
return block.toImmutableState();
|
||||
}
|
||||
return super.getLazyBlock(x, y, z);
|
||||
return super.getBlock(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.boydti.fawe.object.extent;
|
||||
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.extent.Extent;
|
||||
@ -14,7 +15,8 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
public class TransformExtent extends BlockTransformExtent {
|
||||
|
||||
private final MutableBlockVector3 mutable = new MutableBlockVector3();
|
||||
private final MutableVector3 mutable1 = new MutableVector3();
|
||||
private final MutableBlockVector3 mutable2 = new MutableBlockVector3();
|
||||
private BlockVector3 min;
|
||||
private int maxy;
|
||||
|
||||
@ -53,56 +55,45 @@ public class TransformExtent extends BlockTransformExtent {
|
||||
if (min == null) {
|
||||
min = pos;
|
||||
}
|
||||
mutable.mutX(((pos.getX() - min.getX())));
|
||||
mutable.mutY(((pos.getY() - min.getY())));
|
||||
mutable.mutZ(((pos.getZ() - min.getZ())));
|
||||
MutableVector3 tmp = new MutableVector3(getTransform().apply(mutable.toVector3()));
|
||||
tmp.mutX((tmp.getX() + min.getX()));
|
||||
tmp.mutY((tmp.getY() + min.getY()));
|
||||
tmp.mutZ((tmp.getZ() + min.getZ()));
|
||||
return tmp.toBlockPoint();
|
||||
mutable1.mutX(((pos.getX() - min.getX())));
|
||||
mutable1.mutY(((pos.getY() - min.getY())));
|
||||
mutable1.mutZ(((pos.getZ() - min.getZ())));
|
||||
Vector3 tmp = getTransform().apply(mutable1);
|
||||
mutable2.mutX((tmp.getX() + min.getX()));
|
||||
mutable2.mutY((tmp.getY() + min.getY()));
|
||||
mutable2.mutZ((tmp.getZ() + min.getZ()));
|
||||
return mutable2;
|
||||
}
|
||||
|
||||
public BlockVector3 getPos(int x, int y, int z) {
|
||||
if (min == null) {
|
||||
min = BlockVector3.at(x, y, z);
|
||||
}
|
||||
mutable.mutX(((x - min.getX())));
|
||||
mutable.mutY(((y - min.getY())));
|
||||
mutable.mutZ(((z - min.getZ())));
|
||||
MutableVector3 tmp = new MutableVector3(getTransform().apply(mutable.toVector3()));
|
||||
tmp.mutX((tmp.getX() + min.getX()));
|
||||
tmp.mutY((tmp.getY() + min.getY()));
|
||||
tmp.mutZ((tmp.getZ() + min.getZ()));
|
||||
mutable1.mutX(((x - min.getX())));
|
||||
mutable1.mutY(((y - min.getY())));
|
||||
mutable1.mutZ(((z - min.getZ())));
|
||||
Vector3 tmp = getTransform().apply(mutable1);
|
||||
mutable2.mutX((tmp.getX() + min.getX()));
|
||||
mutable2.mutY((tmp.getY() + min.getY()));
|
||||
mutable2.mutZ((tmp.getZ() + min.getZ()));
|
||||
return tmp.toBlockPoint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(int x, int y, int z) {
|
||||
return transform(super.getLazyBlock(getPos(x, y, z)));
|
||||
public BlockState getBlock(int x, int y, int z) {
|
||||
BlockVector3 p = getPos(x, y, z);
|
||||
return transform(super.getBlock(p.getX(), p.getY(), p.getZ()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(BlockVector3 position) {
|
||||
return transform(super.getLazyBlock(getPos(position)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(BlockVector3 position) {
|
||||
return transform(super.getBlock(getPos(position)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBlock getFullBlock(BlockVector3 position) {
|
||||
return transform(super.getFullBlock(getPos(position)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeType getBiome(BlockVector2 position) {
|
||||
mutable.mutX(position.getBlockX());
|
||||
mutable.mutZ(position.getBlockZ());
|
||||
mutable.mutY(0);
|
||||
return super.getBiome(getPos(mutable).toBlockVector2());
|
||||
public BiomeType getBiome(int x, int z) {
|
||||
BlockVector3 p = getPos(x, 0, z);
|
||||
return super.getBiome(p.getX(), p.getZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -117,10 +108,8 @@ public class TransformExtent extends BlockTransformExtent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
||||
mutable.mutX(position.getBlockX());
|
||||
mutable.mutZ(position.getBlockZ());
|
||||
mutable.mutY(0);
|
||||
return super.setBiome(getPos(mutable).toBlockVector2(), biome);
|
||||
public boolean setBiome(int x, int y, int z, BiomeType biome) {
|
||||
BlockVector3 p = getPos(x, y, z);
|
||||
return super.setBiome(p.getX(), p.getY(), p.getZ(), biome);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user