-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refs/heads/1.20/dev' into feat/multi-loader-1.20.4
# Conflicts: # gradle.properties
- Loading branch information
Showing
38 changed files
with
414 additions
and
388 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
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
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
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
58 changes: 48 additions & 10 deletions
58
common/src/lib/java/dev/engine_room/flywheel/lib/instance/FlatLit.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 |
---|---|---|
@@ -1,26 +1,64 @@ | ||
package dev.engine_room.flywheel.lib.instance; | ||
|
||
import java.util.Iterator; | ||
import java.util.stream.Stream; | ||
|
||
import org.jetbrains.annotations.Nullable; | ||
|
||
import dev.engine_room.flywheel.api.instance.Instance; | ||
import dev.engine_room.flywheel.lib.visual.AbstractVisual; | ||
import dev.engine_room.flywheel.lib.visual.AbstractBlockEntityVisual; | ||
import dev.engine_room.flywheel.lib.visual.AbstractEntityVisual; | ||
import net.minecraft.client.renderer.LightTexture; | ||
|
||
/** | ||
* An interface that implementors of {@link Instance} should also implement | ||
* if they wish to make use of the relighting utilities in {@link AbstractVisual}. | ||
* An interface that implementors of {@link Instance} should also implement if they wish to make use of | ||
* {@link #relight} and the relighting utilities in {@link AbstractBlockEntityVisual} and {@link AbstractEntityVisual}. | ||
*/ | ||
public interface FlatLit extends Instance { | ||
/** | ||
* Set the block and sky light values for this instance. | ||
* @param blockLight Block light value | ||
* @param skyLight Sky light value | ||
* Set the packed light value for this instance. | ||
* @param packedLight Packed block and sky light per {@link LightTexture#pack(int, int)} | ||
* @return {@code this} for chaining | ||
*/ | ||
FlatLit light(int blockLight, int skyLight); | ||
FlatLit light(int packedLight); | ||
|
||
/** | ||
* Set the packed light value for this instance. | ||
* @param packedLight Packed block and sky light per {@link LightTexture#pack(int, int)} | ||
* Set the block and sky light values for this instance. | ||
* @param blockLight Block light value | ||
* @param skyLight Sky light value | ||
* @return {@code this} for chaining | ||
*/ | ||
FlatLit light(int packedLight); | ||
default FlatLit light(int blockLight, int skyLight) { | ||
return light(LightTexture.pack(blockLight, skyLight)); | ||
} | ||
|
||
static void relight(int packedLight, @Nullable FlatLit... instances) { | ||
for (FlatLit instance : instances) { | ||
if (instance != null) { | ||
instance.light(packedLight) | ||
.handle() | ||
.setChanged(); | ||
} | ||
} | ||
} | ||
|
||
static void relight(int packedLight, Iterator<@Nullable FlatLit> instances) { | ||
while (instances.hasNext()) { | ||
FlatLit instance = instances.next(); | ||
|
||
if (instance != null) { | ||
instance.light(packedLight) | ||
.handle() | ||
.setChanged(); | ||
} | ||
} | ||
} | ||
|
||
static void relight(int packedLight, Iterable<@Nullable FlatLit> instances) { | ||
relight(packedLight, instances.iterator()); | ||
} | ||
|
||
static void relight(int packedLight, Stream<@Nullable FlatLit> instances) { | ||
relight(packedLight, instances.iterator()); | ||
} | ||
} |
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.