mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-05 12:36:40 +00:00
wip on 1.14
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
|
||||
|
@ -126,12 +126,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);
|
||||
return type.withStateId(combinedId4Data);
|
||||
@ -161,11 +161,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);
|
||||
|
@ -2,6 +2,7 @@ package com.boydti.fawe.object.extent;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.object.FaweLimit;
|
||||
import com.boydti.fawe.object.exception.FaweException;
|
||||
import com.boydti.fawe.util.WEManager;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
@ -56,44 +57,22 @@ public abstract class FaweRegionExtent extends ResettableExtent {
|
||||
return contains(p.getBlockX(), p.getBlockZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
public <B extends BlockStateHolder<B>> boolean setBlock(BlockVector3 location, B block) throws WorldEditException {
|
||||
if (!contains(location)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return super.setBlock(location, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <B extends BlockStateHolder<B>> boolean setBlock(int x, int y, int z, B block) throws WorldEditException {
|
||||
if (!contains(x, y, z)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION);
|
||||
WEManager.IMP.cancelEditSafe(this, FaweException.OUTSIDE_REGION);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return super.setBlock(x, y, z, block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
||||
if (!contains(position)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return super.setBiome(position, biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(int x, int y, int z, BiomeType biome) {
|
||||
if (!contains(x, y, z)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION);
|
||||
WEManager.IMP.cancelEditSafe(this, FaweException.OUTSIDE_REGION);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -104,18 +83,29 @@ public abstract class FaweRegionExtent extends ResettableExtent {
|
||||
public BiomeType getBiome(BlockVector2 position) {
|
||||
if (!contains(position)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION);
|
||||
WEManager.IMP.cancelEditSafe(this, FaweException.OUTSIDE_REGION);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return super.getBiome(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeType getBiomeType(int x, int z) {
|
||||
if (!contains(x, z)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, FaweException.OUTSIDE_REGION);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return super.getBiomeType(x, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBlock getFullBlock(BlockVector3 position) {
|
||||
if (!contains(position)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION);
|
||||
WEManager.IMP.cancelEditSafe(this, FaweException.OUTSIDE_REGION);
|
||||
}
|
||||
return BlockTypes.AIR.getDefaultState().toBaseBlock();
|
||||
}
|
||||
@ -126,40 +116,18 @@ public abstract class FaweRegionExtent extends ResettableExtent {
|
||||
public BlockState getBlock(BlockVector3 position) {
|
||||
if (!contains(position)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION);
|
||||
WEManager.IMP.cancelEditSafe(this, FaweException.OUTSIDE_REGION);
|
||||
}
|
||||
return BlockTypes.AIR.getDefaultState();
|
||||
}
|
||||
return super.getBlock(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(BlockVector3 position) {
|
||||
if (!contains(position)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION);
|
||||
}
|
||||
return BlockTypes.AIR.getDefaultState();
|
||||
}
|
||||
return super.getLazyBlock(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(int x, int y, int z) {
|
||||
if (!contains(x, y, z)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION);
|
||||
}
|
||||
return BlockTypes.AIR.getDefaultState();
|
||||
}
|
||||
return super.getLazyBlock(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockLight(int x, int y, int z) {
|
||||
if (!contains(x, y, z)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION);
|
||||
WEManager.IMP.cancelEditSafe(this, FaweException.OUTSIDE_REGION);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -170,7 +138,7 @@ public abstract class FaweRegionExtent extends ResettableExtent {
|
||||
public int getBrightness(int x, int y, int z) {
|
||||
if (!contains(x, y, z)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION);
|
||||
WEManager.IMP.cancelEditSafe(this, FaweException.OUTSIDE_REGION);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -181,7 +149,7 @@ public abstract class FaweRegionExtent extends ResettableExtent {
|
||||
public int getLight(int x, int y, int z) {
|
||||
if (!contains(x, y, z)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION);
|
||||
WEManager.IMP.cancelEditSafe(this, FaweException.OUTSIDE_REGION);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -192,7 +160,7 @@ public abstract class FaweRegionExtent extends ResettableExtent {
|
||||
public int getOpacity(int x, int y, int z) {
|
||||
if (!contains(x, y, z)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION);
|
||||
WEManager.IMP.cancelEditSafe(this, FaweException.OUTSIDE_REGION);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -203,7 +171,7 @@ public abstract class FaweRegionExtent extends ResettableExtent {
|
||||
public int getSkyLight(int x, int y, int z) {
|
||||
if (!contains(x, y, z)) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION);
|
||||
WEManager.IMP.cancelEditSafe(this, FaweException.OUTSIDE_REGION);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -215,7 +183,7 @@ public abstract class FaweRegionExtent extends ResettableExtent {
|
||||
public Entity createEntity(Location location, BaseEntity entity) {
|
||||
if (!contains(location.getBlockX(), location.getBlockY(), location.getBlockZ())) {
|
||||
if (!limit.MAX_FAILS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_OUTSIDE_REGION);
|
||||
WEManager.IMP.cancelEditSafe(this, FaweException.OUTSIDE_REGION);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package com.boydti.fawe.object.extent;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.object.FawePlayer;
|
||||
import com.boydti.fawe.object.exception.FaweException;
|
||||
import com.boydti.fawe.util.MemUtil;
|
||||
import com.boydti.fawe.util.Perm;
|
||||
import com.boydti.fawe.util.WEManager;
|
||||
@ -30,7 +31,7 @@ public class MemoryCheckingExtent extends AbstractDelegateExtent {
|
||||
BBC.WORLDEDIT_OOM_ADMIN.send(this.player);
|
||||
}
|
||||
}
|
||||
WEManager.IMP.cancelEdit(this, BBC.WORLDEDIT_CANCEL_REASON_LOW_MEMORY);
|
||||
WEManager.IMP.cancelEdit(this, FaweException.LOW_MEMORY);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -25,7 +25,7 @@ import java.util.List;
|
||||
|
||||
public class NullExtent extends FaweRegionExtent {
|
||||
|
||||
private final BBC reason;
|
||||
private final FaweException reason;
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
@ -33,13 +33,16 @@ public class NullExtent extends FaweRegionExtent {
|
||||
* @param extent the extent
|
||||
*/
|
||||
public NullExtent(Extent extent, BBC failReason) {
|
||||
this(extent, new FaweException(failReason));
|
||||
}
|
||||
|
||||
public NullExtent(Extent extent, FaweException exception) {
|
||||
super(extent, FaweLimit.MAX);
|
||||
this.reason = failReason;
|
||||
this.reason = exception;
|
||||
}
|
||||
|
||||
public NullExtent() {
|
||||
super(new com.sk89q.worldedit.extent.NullExtent(), FaweLimit.MAX);
|
||||
this.reason = BBC.WORLDEDIT_CANCEL_REASON_MANUAL;
|
||||
this(new com.sk89q.worldedit.extent.NullExtent(), FaweException.MANUAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -50,7 +53,7 @@ public class NullExtent extends FaweRegionExtent {
|
||||
@Override
|
||||
public BiomeType getBiome(final BlockVector2 arg0) {
|
||||
if(reason != null) {
|
||||
throw new FaweException(reason);
|
||||
throw reason;
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
@ -59,25 +62,34 @@ public class NullExtent extends FaweRegionExtent {
|
||||
@Override
|
||||
public BlockState getBlock(final BlockVector3 arg0) {
|
||||
if(reason != null) {
|
||||
throw new FaweException(reason);
|
||||
throw reason;
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(final BlockVector3 arg0) {
|
||||
public BlockState getBlock(int x, int y, int z) {
|
||||
if(reason != null) {
|
||||
throw new FaweException(reason);
|
||||
throw reason;
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBlock getFullBlock(int x, int y, int z) {
|
||||
if(reason != null) {
|
||||
throw reason;
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setBiome(final BlockVector2 arg0, final BiomeType arg1) {
|
||||
if(reason != null) {
|
||||
throw new FaweException(reason);
|
||||
throw reason;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
@ -86,7 +98,7 @@ public class NullExtent extends FaweRegionExtent {
|
||||
@Override
|
||||
public boolean setBlock(final BlockVector3 arg0, final BlockStateHolder arg1) throws WorldEditException {
|
||||
if(reason != null) {
|
||||
throw new FaweException(reason);
|
||||
throw reason;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
@ -95,25 +107,16 @@ public class NullExtent extends FaweRegionExtent {
|
||||
@Override
|
||||
public boolean setBlock(int x, int y, int z, BlockStateHolder block) throws WorldEditException {
|
||||
if(reason != null) {
|
||||
throw new FaweException(reason);
|
||||
throw reason;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@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) {
|
||||
throw new FaweException(reason);
|
||||
throw reason;
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
@ -142,7 +145,7 @@ public class NullExtent extends FaweRegionExtent {
|
||||
@Override
|
||||
public boolean contains(int x, int z) {
|
||||
if(reason != null) {
|
||||
throw new FaweException(reason);
|
||||
throw reason;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
@ -151,7 +154,7 @@ public class NullExtent extends FaweRegionExtent {
|
||||
@Override
|
||||
public boolean contains(int x, int y, int z) {
|
||||
if(reason != null) {
|
||||
throw new FaweException(reason);
|
||||
throw reason;
|
||||
}else {
|
||||
return false;
|
||||
}
|
||||
@ -176,7 +179,7 @@ public class NullExtent extends FaweRegionExtent {
|
||||
@Override
|
||||
public int getNearestSurfaceLayer(int x, int z, int y, int minY, int maxY) {
|
||||
if(reason != null) {
|
||||
throw new FaweException(reason);
|
||||
throw reason;
|
||||
}else {
|
||||
return -1;
|
||||
}
|
||||
@ -185,7 +188,7 @@ public class NullExtent extends FaweRegionExtent {
|
||||
@Override
|
||||
public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY) {
|
||||
if(reason != null) {
|
||||
throw new FaweException(reason);
|
||||
throw reason;
|
||||
}else {
|
||||
return -1;
|
||||
}
|
||||
@ -194,7 +197,7 @@ public class NullExtent extends FaweRegionExtent {
|
||||
@Override
|
||||
public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY, int failedMin, int failedMax) {
|
||||
if(reason != null) {
|
||||
throw new FaweException(reason);
|
||||
throw reason;
|
||||
}else {
|
||||
return -1;
|
||||
}
|
||||
|
@ -46,13 +46,8 @@ 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
|
||||
|
@ -2,6 +2,7 @@ package com.boydti.fawe.object.extent;
|
||||
|
||||
import com.boydti.fawe.config.BBC;
|
||||
import com.boydti.fawe.object.FaweLimit;
|
||||
import com.boydti.fawe.object.exception.FaweException;
|
||||
import com.boydti.fawe.util.WEManager;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
@ -40,7 +41,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
return null;
|
||||
}
|
||||
if (!limit.MAX_ENTITIES()) {
|
||||
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_MAX_ENTITIES);
|
||||
WEManager.IMP.cancelEditSafe(this, FaweException.MAX_ENTITIES);
|
||||
return null;
|
||||
}
|
||||
return super.createEntity(location, entity);
|
||||
@ -62,19 +63,19 @@ 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);
|
||||
WEManager.IMP.cancelEditSafe(this, FaweException.MAX_CHECKS);
|
||||
return BlockTypes.AIR.getDefaultState();
|
||||
} else {
|
||||
return extent.getLazyBlock(x, y, z);
|
||||
return extent.getBlock(x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseBlock getFullBlock(BlockVector3 pos) {
|
||||
if (!limit.MAX_CHECKS()) {
|
||||
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_MAX_CHECKS);
|
||||
WEManager.IMP.cancelEditSafe(this, FaweException.MAX_CHECKS);
|
||||
return BlockTypes.AIR.getDefaultState().toBaseBlock();
|
||||
} else {
|
||||
return extent.getFullBlock(pos);
|
||||
@ -87,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
|
||||
@ -96,18 +97,18 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
boolean hasNbt = block instanceof BaseBlock && ((BaseBlock)block).hasNbtData();
|
||||
if (hasNbt) {
|
||||
if (!limit.MAX_BLOCKSTATES()) {
|
||||
WEManager.IMP.cancelEdit(this, BBC.WORLDEDIT_CANCEL_REASON_MAX_TILES);
|
||||
WEManager.IMP.cancelEdit(this, FaweException.MAX_TILES);
|
||||
return false;
|
||||
} else {
|
||||
if (!limit.MAX_CHANGES()) {
|
||||
WEManager.IMP.cancelEdit(this, BBC.WORLDEDIT_CANCEL_REASON_MAX_CHANGES);
|
||||
WEManager.IMP.cancelEdit(this, FaweException.MAX_CHANGES);
|
||||
return false;
|
||||
}
|
||||
return extent.setBlock(x, y, z, block);
|
||||
}
|
||||
}
|
||||
if (!limit.MAX_CHANGES()) {
|
||||
WEManager.IMP.cancelEdit(this, BBC.WORLDEDIT_CANCEL_REASON_MAX_CHANGES);
|
||||
WEManager.IMP.cancelEdit(this, FaweException.MAX_CHANGES);
|
||||
return false;
|
||||
} else {
|
||||
return extent.setBlock(x, y, z, block);
|
||||
@ -117,7 +118,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||
@Override
|
||||
public boolean setBiome(final BlockVector2 position, final BiomeType biome) {
|
||||
if (!limit.MAX_CHANGES()) {
|
||||
WEManager.IMP.cancelEditSafe(this, BBC.WORLDEDIT_CANCEL_REASON_MAX_CHANGES);
|
||||
WEManager.IMP.cancelEditSafe(this, FaweException.MAX_CHANGES);
|
||||
return false;
|
||||
}
|
||||
return super.setBiome(position, biome);
|
||||
|
@ -57,19 +57,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;
|
||||
|
||||
public TransformExtent(Extent parent) {
|
||||
@ -50,43 +52,34 @@ 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)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getLazyBlock(BlockVector3 position) {
|
||||
return transform(super.getLazyBlock(getPos(position)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getBlock(BlockVector3 position) {
|
||||
return transform(super.getBlock(getPos(position)));
|
||||
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
|
||||
@ -95,11 +88,9 @@ public class TransformExtent extends BlockTransformExtent {
|
||||
}
|
||||
|
||||
@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 getBiomeType(int x, int z) {
|
||||
BlockVector3 p = getPos(x, 0, z);
|
||||
return super.getBiomeType(p.getX(), p.getZ());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -114,10 +105,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