Renaming and cleanup and a new method.

This commit is contained in:
MattBDev
2019-07-09 15:50:13 -04:00
parent 0feebac44b
commit 4a40c7d99c
79 changed files with 893 additions and 1226 deletions

View File

@ -28,7 +28,7 @@ public class MultiTransform extends RandomTransform {
@Override
public void add(ResettableExtent extent, double chance) {
super.add(extent, chance);
this.extents = getExtents().toArray(new ResettableExtent[getExtents().size()]);
this.extents = getExtents().toArray(new ResettableExtent[0]);
}
@Override

View File

@ -3,9 +3,8 @@ 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.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity;
import com.sk89q.worldedit.extent.Extent;
@ -15,6 +14,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.BiomeType;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import javax.annotation.Nullable;
@ -41,7 +41,7 @@ public class NullExtent extends FaweRegionExtent {
super(new com.sk89q.worldedit.extent.NullExtent(), FaweLimit.MAX);
this.reason = BBC.WORLDEDIT_CANCEL_REASON_MANUAL;
}
@Override
public ResettableExtent setExtent(Extent extent) {
return this;
@ -49,74 +49,66 @@ public class NullExtent extends FaweRegionExtent {
@Override
public BiomeType getBiome(final BlockVector2 arg0) {
if(reason != null) {
throw new FaweException(reason);
}else {
return null;
if (reason != null) {
throw new FaweException(reason);
}
return null;
}
@Override
public BlockState getBlock(final BlockVector3 arg0) {
if(reason != null) {
throw new FaweException(reason);
}else {
return null;
if (reason != null) {
throw new FaweException(reason);
}
return null;
}
@Override
public BlockState getLazyBlock(final BlockVector3 arg0) {
if(reason != null) {
throw new FaweException(reason);
}else {
return null;
if (reason != null) {
throw new FaweException(reason);
}
return null;
}
@Override
public boolean setBiome(final BlockVector2 arg0, final BiomeType arg1) {
if(reason != null) {
throw new FaweException(reason);
}else {
return false;
if (reason != null) {
throw new FaweException(reason);
}
return false;
}
@Override
public boolean setBlock(final BlockVector3 arg0, final BlockStateHolder arg1) throws WorldEditException {
if(reason != null) {
throw new FaweException(reason);
}else {
return false;
if (reason != null) {
throw new FaweException(reason);
}
return false;
}
@Override
public boolean setBlock(int x, int y, int z, BlockStateHolder block) throws WorldEditException {
if(reason != null) {
throw new FaweException(reason);
}else {
return false;
if (reason != null) {
throw new FaweException(reason);
}
return false;
}
@Override
public BlockState getLazyBlock(int x, int y, int z) {
if(reason != null) {
throw new FaweException(reason);
}else {
return null;
if (reason != null) {
throw new FaweException(reason);
}
return null;
}
@Override
public Entity createEntity(final Location arg0, final BaseEntity arg1) {
if(reason != null) {
throw new FaweException(reason);
}else {
return null;
if (reason != null) {
throw new FaweException(reason);
}
return null;
}
@Override
@ -131,30 +123,28 @@ public class NullExtent extends FaweRegionExtent {
@Override
public BlockVector3 getMaximumPoint() {
return BlockVector3.at(0, 0, 0);
return BlockVector3.ZERO;
}
@Override
public BlockVector3 getMinimumPoint() {
return BlockVector3.at(0, 0, 0);
return BlockVector3.ZERO;
}
@Override
public boolean contains(int x, int z) {
if(reason != null) {
throw new FaweException(reason);
}else {
return false;
if (reason != null) {
throw new FaweException(reason);
}
return false;
}
@Override
public boolean contains(int x, int y, int z) {
if(reason != null) {
throw new FaweException(reason);
}else {
return false;
if (reason != null) {
throw new FaweException(reason);
}
return false;
}
@Override
@ -162,11 +152,6 @@ public class NullExtent extends FaweRegionExtent {
return Collections.emptyList();
}
@Override
protected Operation commitBefore() {
return null;
}
@Nullable
@Override
public Operation commit() {
@ -175,29 +160,26 @@ 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);
}else {
return -1;
if (reason != null) {
throw new FaweException(reason);
}
return -1;
}
@Override
public int getNearestSurfaceTerrainBlock(int x, int z, int y, int minY, int maxY) {
if(reason != null) {
throw new FaweException(reason);
}else {
return -1;
if (reason != null) {
throw new FaweException(reason);
}
return -1;
}
@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);
}else {
return -1;
if (reason != null) {
throw new FaweException(reason);
}
return -1;
}
@Override

View File

@ -3,23 +3,21 @@ package com.boydti.fawe.object.extent;
import com.boydti.fawe.config.BBC;
import com.boydti.fawe.object.FaweLimit;
import com.boydti.fawe.util.WEManager;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.entity.BaseEntity;
import com.sk89q.worldedit.entity.Entity;
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.regions.Region;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.biome.BiomeType;
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;
import java.util.List;
public class ProcessedWEExtent extends AbstractDelegateExtent {
private final FaweLimit limit;
private final AbstractDelegateExtent extent;
@ -46,21 +44,6 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
return super.createEntity(location, entity);
}
@Override
public BiomeType getBiome(final BlockVector2 position) {
return super.getBiome(position);
}
@Override
public List<? extends Entity> getEntities() {
return super.getEntities();
}
@Override
public List<? extends Entity> getEntities(final Region region) {
return super.getEntities(region);
}
@Override
public BlockState getLazyBlock(int x, int y, int z) {
if (!limit.MAX_CHECKS()) {

View File

@ -30,7 +30,7 @@ public class StripNBTExtent extends AbstractDelegateExtent {
*/
public StripNBTExtent(Extent extent, Set<String> strip) {
super(extent);
this.strip = strip.toArray(new String[strip.size()]);
this.strip = strip.toArray(new String[0]);
}
@Override
@ -60,7 +60,7 @@ public class StripNBTExtent extends AbstractDelegateExtent {
}
return (B) localBlock;
}
public <T extends NbtValued> T stripEntityNBT(T entity) {
if (!entity.hasNbtData()) return entity;
CompoundTag nbt = entity.getNbtData();