mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-02 19:36:41 +00:00
Fix relight and removelight (#475)
* Start work on lighting engine (does not build) * Implement getLighting * Setting, flushing light etc works. Getting light should be working..? * Better queue/chunk handling * Use correct location for lighting update * Correct set location, remove debug * cleanup a little * Fix fixlight * Apply to all versions for the numpties * Remove lighting extent if not using * Actually bitmask blocks when setting in chunks * Initialise Maps and Dequeues with inital size * format * Documentation maybe
This commit is contained in:
@ -205,6 +205,46 @@ public class AbstractDelegateExtent implements Extent {
|
||||
public boolean setBiome(BlockVector2 position, BiomeType biome) {
|
||||
return extent.setBiome(position.getX(), 0, position.getZ(), biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean relight(int x, int y, int z) {
|
||||
return extent.relight(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean relightBlock(int x, int y, int z) {
|
||||
return extent.relightBlock(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean relightSky(int x, int y, int z) {
|
||||
return extent.relightSky(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSkyLight(int x, int y, int z, int value) {
|
||||
extent.setSkyLight(x, y, z, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockLight(int x, int y, int z, int value) {
|
||||
extent.setSkyLight(x, y, z, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSkyLight(int x, int y, int z) {
|
||||
return extent.getSkyLight(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEmmittedLight(int x, int y, int z) {
|
||||
return extent.getEmmittedLight(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBrightness(int x, int y, int z) {
|
||||
return extent.getBrightness(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
@ -651,6 +651,18 @@ public interface Extent extends InputExtent, OutputExtent {
|
||||
return count;
|
||||
}
|
||||
|
||||
default boolean relight(int x, int y, int z) {
|
||||
return false;
|
||||
}
|
||||
|
||||
default boolean relightBlock(int x, int y, int z) {
|
||||
return false;
|
||||
}
|
||||
|
||||
default boolean relightSky(int x, int y, int z) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Have an extent processed
|
||||
* - Either block (Extent) processing or chunk processing
|
||||
|
@ -85,4 +85,48 @@ public interface InputExtent {
|
||||
default BiomeType getBiomeType(int x, int y, int z) {
|
||||
return getBiome(MutableBlockVector2.get(x, z));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the light level at the given location
|
||||
*
|
||||
* @param position location
|
||||
* @return the light level at the location
|
||||
*/
|
||||
default int getEmmittedLight(MutableBlockVector3 position) {
|
||||
return getEmmittedLight(position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
|
||||
default int getEmmittedLight(int x, int y, int z) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the sky light level at the given location
|
||||
*
|
||||
* @param position location
|
||||
* @return the sky light level at the location
|
||||
*/
|
||||
default int getSkyLight(MutableBlockVector3 position) {
|
||||
return getSkyLight(position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
|
||||
default int getSkyLight(int x, int y, int z) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
default int getBrightness(MutableBlockVector3 position) {
|
||||
return getBrightness(position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
|
||||
default int getBrightness(int x, int y, int z) {
|
||||
return getFullBlock(x, y, z).getMaterial().getLightValue();
|
||||
}
|
||||
|
||||
default int getOpacity(MutableBlockVector3 position) {
|
||||
return getOpacity(position.getX(), position.getY(), position.getZ());
|
||||
}
|
||||
|
||||
default int getOpacity(int x, int y, int z) {
|
||||
return getFullBlock(x, y, z).getMaterial().getLightOpacity();
|
||||
}
|
||||
}
|
||||
|
@ -82,6 +82,30 @@ public interface OutputExtent {
|
||||
return setBiome(MutableBlockVector2.get(x, z), biome);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the light value
|
||||
*
|
||||
* @param position position of the block
|
||||
* @param value light level to set
|
||||
*/
|
||||
default void setBlockLight(BlockVector3 position, int value) {
|
||||
setBlockLight(position.getX(), position.getY(), position.getZ(), value);
|
||||
}
|
||||
|
||||
default void setBlockLight(int x, int y, int z, int value) {}
|
||||
|
||||
/**
|
||||
* Set the sky light value
|
||||
*
|
||||
* @param position position of the block
|
||||
* @param value light level to set
|
||||
*/
|
||||
default void setSkyLight(BlockVector3 position, int value) {
|
||||
setSkyLight(position.getX(), position.getY(), position.getZ(), value);
|
||||
}
|
||||
|
||||
default void setSkyLight(int x, int y, int z, int value) {}
|
||||
|
||||
/**
|
||||
* Return an {@link Operation} that should be called to tie up loose ends
|
||||
* (such as to commit changes in a buffer).
|
||||
|
Reference in New Issue
Block a user