mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2025-01-24 03:47:54 +01:00
Lit on init
- Automatically call updateLight upon visual creation
This commit is contained in:
parent
fe0eacad8e
commit
cc0ad90242
5 changed files with 5 additions and 9 deletions
|
@ -9,8 +9,7 @@ package dev.engine_room.flywheel.api.visual;
|
|||
*/
|
||||
public non-sealed interface LightUpdatedVisual extends SectionTrackedVisual {
|
||||
/**
|
||||
* Called when a section this visual is contained in receives a light update. It is not called
|
||||
* unconditionally after visual creation or {@link SectionCollector#sections}.
|
||||
* Called after visual construction and when a section this visual is contained in receives a light update.
|
||||
*
|
||||
* <p>Even if multiple sections are updated at the same time, this method will only be called once.</p>
|
||||
*
|
||||
|
|
|
@ -128,7 +128,7 @@ public abstract class Storage<T> {
|
|||
var out = createRaw(obj, partialTick);
|
||||
|
||||
if (out != null) {
|
||||
setup(out);
|
||||
setup(out, partialTick);
|
||||
}
|
||||
|
||||
return out;
|
||||
|
@ -139,7 +139,7 @@ public abstract class Storage<T> {
|
|||
var visual = createRaw(obj, partialTick);
|
||||
|
||||
if (visual != null) {
|
||||
setup(visual);
|
||||
setup(visual, partialTick);
|
||||
visuals.put(obj, visual);
|
||||
}
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ public abstract class Storage<T> {
|
|||
@Nullable
|
||||
protected abstract Visual createRaw(T obj, float partialTick);
|
||||
|
||||
private void setup(Visual visual) {
|
||||
private void setup(Visual visual, float partialTick) {
|
||||
if (visual instanceof DynamicVisual dynamic) {
|
||||
if (visual instanceof SimpleDynamicVisual simpleDynamic) {
|
||||
simpleDynamicVisuals.add(simpleDynamic);
|
||||
|
@ -172,6 +172,7 @@ public abstract class Storage<T> {
|
|||
|
||||
if (visual instanceof LightUpdatedVisual lightUpdated) {
|
||||
lightUpdatedVisuals.add(lightUpdated, tracker);
|
||||
lightUpdated.updateLight(partialTick);
|
||||
}
|
||||
|
||||
if (visual instanceof ShaderLightVisual shaderLight) {
|
||||
|
|
|
@ -38,7 +38,6 @@ public class BellVisual extends AbstractBlockEntityVisual<BellBlockEntity> imple
|
|||
bell.setChanged();
|
||||
|
||||
updateRotation(partialTick);
|
||||
updateLight(partialTick);
|
||||
}
|
||||
|
||||
private OrientedInstance createBellInstance() {
|
||||
|
|
|
@ -88,7 +88,6 @@ public class ChestVisual<T extends BlockEntity & LidBlockEntity> extends Abstrac
|
|||
bottom.setChanged();
|
||||
|
||||
applyLidTransform(lidProgress.get(partialTick));
|
||||
updateLight(partialTick);
|
||||
}
|
||||
|
||||
private OrientedInstance createBottomInstance(Material texture) {
|
||||
|
|
|
@ -67,8 +67,6 @@ public class ShulkerBoxVisual extends AbstractBlockEntityVisual<ShulkerBoxBlockE
|
|||
base.setChanged();
|
||||
lid = createLidInstance(texture).setTransform(stack);
|
||||
lid.setChanged();
|
||||
|
||||
updateLight(partialTick);
|
||||
}
|
||||
|
||||
private TransformedInstance createBaseInstance(Material texture) {
|
||||
|
|
Loading…
Reference in a new issue