Fixlighting now also calculates heightmaps

Fixes #386 and #438 seems fixed, but that might be something else that fixed?
This commit is contained in:
dordsor21
2020-09-14 14:19:23 +01:00
parent 0685881f64
commit d6c9a887ac
24 changed files with 295 additions and 41 deletions

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.extent;
import com.boydti.fawe.beta.implementation.lighting.HeightMapType;
import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.internal.util.DeprecationUtil;
import com.sk89q.worldedit.internal.util.NonAbstractForCompatibility;
@ -80,8 +81,7 @@ public interface InputExtent {
* @return the biome at the location
* @deprecated Biomes in Minecraft are 3D now, use {@link InputExtent#getBiome(BlockVector3)}
*/
@Deprecated
default BiomeType getBiome(BlockVector2 position) {
@Deprecated default BiomeType getBiome(BlockVector2 position) {
return getBiomeType(position.getX(), 0, position.getZ());
}
@ -93,26 +93,22 @@ public interface InputExtent {
* Get the biome at the given location.
*
* <p>
* If there is no biome available, then the ocean biome should be
* returned.
* If there is no biome available, then the ocean biome should be
* returned.
* </p>
*
* <p>
* As implementation varies per Minecraft version, this may not exactly get
* this positions biome. On versions prior to 1.15, this will get the entire
* column. On later versions it will get the 4x4x4 cube's biome.
* As implementation varies per Minecraft version, this may not exactly get
* this positions biome. On versions prior to 1.15, this will get the entire
* column. On later versions it will get the 4x4x4 cube's biome.
* </p>
*
* @param position the (x, y, z) location to check the biome at
* @return the biome at the location
* @apiNote This must be overridden by new subclasses. See {@link NonAbstractForCompatibility}
* for details
* for details
*/
@NonAbstractForCompatibility(
delegateName = "getBiome",
delegateParams = { BlockVector2.class }
)
default BiomeType getBiome(BlockVector3 position) {
@NonAbstractForCompatibility(delegateName = "getBiome", delegateParams = {BlockVector2.class}) default BiomeType getBiome(BlockVector3 position) {
DeprecationUtil.checkDelegatingOverride(getClass());
return getBiome(position.toBlockVector2());
@ -161,4 +157,8 @@ public interface InputExtent {
default int getOpacity(int x, int y, int z) {
return getFullBlock(x, y, z).getMaterial().getLightOpacity();
}
default int[] getHeightMap(HeightMapType type) {
return new int[256];
}
}

View File

@ -19,6 +19,7 @@
package com.sk89q.worldedit.extent;
import com.boydti.fawe.beta.implementation.lighting.HeightMapType;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.WorldEditException;
import com.sk89q.worldedit.function.operation.Operation;
@ -158,6 +159,9 @@ public interface OutputExtent {
default void setSkyLight(int x, int y, int z, int value) {
}
default void setHeightMap(HeightMapType type, int[] heightMap) {
}
/**
* Return an {@link Operation} that should be called to tie up loose ends
* (such as to commit changes in a buffer).