-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/MC_1.17_lighting' into MC_1.17_Jar
- Loading branch information
Showing
55 changed files
with
1,450 additions
and
349 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/main/java/io/github/opencubicchunks/cubicchunks/chunk/CubeMap.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package io.github.opencubicchunks.cubicchunks.chunk; | ||
|
||
import java.util.Set; | ||
import java.util.concurrent.ConcurrentHashMap; | ||
|
||
public class CubeMap { | ||
private final ConcurrentHashMap.KeySetView<Integer, Boolean> loadedCubes = ConcurrentHashMap.newKeySet(); | ||
|
||
public boolean isLoaded(int cubeY) { | ||
return loadedCubes.contains(cubeY); | ||
} | ||
|
||
public void markLoaded(int cubeY) { | ||
loadedCubes.add(cubeY); | ||
} | ||
|
||
public void markUnloaded(int cubeY) { | ||
loadedCubes.remove(cubeY); | ||
} | ||
|
||
public Set<Integer> getLoaded() { | ||
return loadedCubes; | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/java/io/github/opencubicchunks/cubicchunks/chunk/CubeMapGetter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package io.github.opencubicchunks.cubicchunks.chunk; | ||
|
||
public interface CubeMapGetter { | ||
CubeMap getCubeMap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/main/java/io/github/opencubicchunks/cubicchunks/chunk/LightHeightmapGetter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package io.github.opencubicchunks.cubicchunks.chunk; | ||
|
||
import io.github.opencubicchunks.cubicchunks.chunk.heightmap.ClientLightSurfaceTracker; | ||
import io.github.opencubicchunks.cubicchunks.chunk.heightmap.LightSurfaceTrackerWrapper; | ||
import net.minecraft.world.level.levelgen.Heightmap; | ||
|
||
public interface LightHeightmapGetter { | ||
Heightmap getLightHeightmap(); | ||
|
||
// Do not override this | ||
default ClientLightSurfaceTracker getClientLightHeightmap() { | ||
Heightmap lightHeightmap = this.getLightHeightmap(); | ||
if (!(lightHeightmap instanceof ClientLightSurfaceTracker)) { | ||
throw new IllegalStateException("Attempted to get client light heightmap on server"); | ||
} | ||
return (ClientLightSurfaceTracker) lightHeightmap; | ||
} | ||
|
||
// Do not override this | ||
default LightSurfaceTrackerWrapper getServerLightHeightmap() { | ||
Heightmap lightHeightmap = this.getLightHeightmap(); | ||
if (!(lightHeightmap instanceof LightSurfaceTrackerWrapper)) { | ||
throw new IllegalStateException("Attempted to get server light heightmap on client"); | ||
} | ||
return (LightSurfaceTrackerWrapper) lightHeightmap; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.