From b6da803886f9fb177daaaefcbe149cddbc2c764c Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Sat, 21 Sep 2024 12:10:56 -0700 Subject: [PATCH] On track to stability - Fix track visuals not appearing when first placed - Fix blaze burner's heads appearing at 0,0,0 until you look at them - Bump flywheel version to fix crash when breaking blocks --- gradle.properties | 2 +- .../processing/burner/BlazeBurnerVisual.java | 10 +++++-- .../content/trains/track/TrackVisual.java | 27 ++++++++++--------- 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/gradle.properties b/gradle.properties index 807df18dc..3063a0283 100644 --- a/gradle.properties +++ b/gradle.properties @@ -23,7 +23,7 @@ use_parchment = true # dependency versions registrate_version = MC1.20-1.3.3 flywheel_minecraft_version = 1.20.1 -flywheel_version = 1.0.0-beta-134 +flywheel_version = 1.0.0-beta-136 jei_minecraft_version = 1.20.1 jei_version = 15.10.0.39 curios_minecraft_version = 1.20.1 diff --git a/src/main/java/com/simibubi/create/content/processing/burner/BlazeBurnerVisual.java b/src/main/java/com/simibubi/create/content/processing/burner/BlazeBurnerVisual.java index 1bb3688a6..2542cdd3e 100644 --- a/src/main/java/com/simibubi/create/content/processing/burner/BlazeBurnerVisual.java +++ b/src/main/java/com/simibubi/create/content/processing/burner/BlazeBurnerVisual.java @@ -77,6 +77,8 @@ public class BlazeBurnerVisual extends AbstractBlockEntityVisual 0.125f; @@ -135,7 +141,7 @@ public class BlazeBurnerVisual extends AbstractBlockEntityVisual { - private final List visuals; + private final List visuals = new ArrayList<>(); public TrackVisual(VisualizationContext context, TrackBlockEntity track, float partialTick) { super(context, track, partialTick); - visuals = blockEntity.connections.values() - .stream() - .map(this::createInstance) - .filter(Objects::nonNull) - .toList(); + collectConnections(); } @Override @@ -49,13 +46,22 @@ public class TrackVisual extends AbstractBlockEntityVisual { return; _delete(); + + collectConnections(); + lightSections.sections(collectLightSections()); } + private void collectConnections() { + blockEntity.connections.values() + .stream() + .map(this::createInstance) + .filter(Objects::nonNull) + .forEach(visuals::add); + } + @Override public void updateLight(float partialTick) { - if (visuals == null) - return; visuals.forEach(BezierTrackVisual::updateLight); } @@ -68,9 +74,8 @@ public class TrackVisual extends AbstractBlockEntityVisual { @Override public void _delete() { - if (visuals == null) - return; visuals.forEach(BezierTrackVisual::delete); + visuals.clear(); } public LongSet collectLightSections() { @@ -102,8 +107,6 @@ public class TrackVisual extends AbstractBlockEntityVisual { @Override public void collectCrumblingInstances(Consumer consumer) { - if (visuals == null) - return; for (BezierTrackVisual instance : visuals) { instance.collectCrumblingInstances(consumer); }