Removed LightingExtent and organized some classes.

This commit is contained in:
MattBDev
2020-03-18 12:58:18 -04:00
parent 8a70f97445
commit 2f8c2666df
34 changed files with 30 additions and 173 deletions

View File

@@ -20,9 +20,9 @@
//import com.boydti.fawe.object.mask.SkyLightMask;
//import com.boydti.fawe.object.mask.SurfaceMask;
//import com.boydti.fawe.object.mask.WallMask;
//import com.boydti.fawe.object.mask.XAxisMask;
//import com.boydti.fawe.object.mask.YAxisMask;
//import com.boydti.fawe.object.mask.ZAxisMask;
//import com.boydti.fawe.function.mask.XAxisMask;
//import com.boydti.fawe.function.mask.YAxisMask;
//import com.boydti.fawe.function.mask.ZAxisMask;
//import com.sk89q.worldedit.IncompleteRegionException;
//import com.sk89q.worldedit.LocalSession;
//import com.sk89q.worldedit.WorldEdit;

View File

@@ -26,7 +26,6 @@ import com.boydti.fawe.beta.IBatchProcessor;
import com.boydti.fawe.object.HistoryExtent;
import com.boydti.fawe.object.changeset.AbstractChangeSet;
import com.boydti.fawe.object.exception.FaweException;
import com.boydti.fawe.object.extent.LightingExtent;
import com.boydti.fawe.util.ExtentTraverser;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.WorldEditException;
@@ -52,7 +51,7 @@ import org.jetbrains.annotations.Range;
/**
* A base class for {@link Extent}s that merely passes extents onto another.
*/
public class AbstractDelegateExtent implements Extent, LightingExtent {
public class AbstractDelegateExtent implements Extent {
private final Extent extent;
@@ -200,55 +199,7 @@ public class AbstractDelegateExtent implements Extent, LightingExtent {
public boolean setBiome(BlockVector2 position, BiomeType biome) {
return extent.setBiome(position.getX(), 0, position.getZ(), biome);
}
@Override
public int getSkyLight(int x, int y, int z) {
if (extent instanceof LightingExtent) {
return ((LightingExtent) extent).getSkyLight(x, y, z);
}
return 0;
}
@Override
public int getBlockLight(int x, int y, int z) {
if (extent instanceof LightingExtent) {
return ((LightingExtent) extent).getBlockLight(x, y, z);
}
return getBrightness(x, y, z);
}
@Override
public int getOpacity(int x, int y, int z) {
if (extent instanceof LightingExtent) {
return ((LightingExtent) extent).getOpacity(x, y, z);
}
return getBlock(x, y, z).getBlockType().getMaterial().getLightOpacity();
}
@Override
public int getLight(int x, int y, int z) {
if (extent instanceof LightingExtent) {
return ((LightingExtent) extent).getLight(x, y, z);
}
return 0;
}
@Override
public int getBrightness(int x, int y, int z) {
if (extent instanceof LightingExtent) {
return ((LightingExtent) extent).getBrightness(x, y, z);
}
return getBlock(x, y, z).getBlockType().getMaterial().getLightValue();
}
@Override
public void relightChunk(int chunkX, int chunkZ) {
if (extent instanceof LightingExtent) {
((LightingExtent) extent).relightChunk(chunkX, chunkZ);
} else {
throw new UnsupportedOperationException("Cannot relight");
}
}
@Override
public String toString() {
return super.toString() + ":" + (extent == this ? "" : extent.toString());

View File

@@ -17,10 +17,6 @@ public class DelegateExtentMask extends AbstractDelegateMask {
return super.test(extent, vector);
}
public Extent getExtent() {
return extent;
}
@Override
public Mask withExtent(Extent extent) {
return new DelegateExtentMask(extent, getMask());

View File

@@ -22,7 +22,6 @@ package com.sk89q.worldedit.world;
import com.boydti.fawe.beta.IChunkGet;
import com.boydti.fawe.beta.implementation.packet.ChunkPacket;
import com.boydti.fawe.beta.IChunkCache;
import com.boydti.fawe.object.extent.LightingExtent;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.MaxChangedBlocksException;
import com.sk89q.worldedit.WorldEditException;
@@ -134,10 +133,6 @@ public interface World extends Extent, Keyed, IChunkCache<IChunkGet> {
* @return the light level (0-15)
*/
default int getBlockLightLevel(BlockVector3 position) {
if (this instanceof LightingExtent) {
LightingExtent extent = (LightingExtent) this;
return extent.getBlockLight(position.getX(), position.getY(), position.getZ());
}
return getBlock(position).getMaterial().getLightValue();
}