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
This commit is contained in:
Jozufozu 2024-09-21 12:10:56 -07:00
parent cdc41b18cc
commit b6da803886
3 changed files with 24 additions and 15 deletions

View file

@ -23,7 +23,7 @@ use_parchment = true
# dependency versions # dependency versions
registrate_version = MC1.20-1.3.3 registrate_version = MC1.20-1.3.3
flywheel_minecraft_version = 1.20.1 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_minecraft_version = 1.20.1
jei_version = 15.10.0.39 jei_version = 15.10.0.39
curios_minecraft_version = 1.20.1 curios_minecraft_version = 1.20.1

View file

@ -77,6 +77,8 @@ public class BlazeBurnerVisual extends AbstractBlockEntityVisual<BlazeBurnerBloc
smallRods = null; smallRods = null;
largeRods = null; largeRods = null;
} }
animate(partialTick);
} }
@Override @Override
@ -90,7 +92,11 @@ public class BlazeBurnerVisual extends AbstractBlockEntityVisual<BlazeBurnerBloc
return; return;
} }
float animation = blockEntity.headAnimation.getValue(ctx.partialTick()) * .175f; animate(ctx.partialTick());
}
private void animate(float partialTicks) {
float animation = blockEntity.headAnimation.getValue(partialTicks) * .175f;
boolean validBlockAbove = animation > 0.125f; boolean validBlockAbove = animation > 0.125f;
@ -135,7 +141,7 @@ public class BlazeBurnerVisual extends AbstractBlockEntityVisual<BlazeBurnerBloc
float offset = Mth.sin((float) ((renderTick / 16f) % (2 * Math.PI))) / offsetMult; float offset = Mth.sin((float) ((renderTick / 16f) % (2 * Math.PI))) / offsetMult;
float headY = offset - (animation * .75f); float headY = offset - (animation * .75f);
float horizontalAngle = AngleHelper.rad(blockEntity.headAngle.getValue(ctx.partialTick())); float horizontalAngle = AngleHelper.rad(blockEntity.headAngle.getValue(partialTicks));
head.setIdentityTransform() head.setIdentityTransform()
.translate(getVisualPosition()) .translate(getVisualPosition())

View file

@ -1,5 +1,6 @@
package com.simibubi.create.content.trains.track; package com.simibubi.create.content.trains.track;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.function.Consumer; import java.util.function.Consumer;
@ -31,16 +32,12 @@ import net.minecraft.world.level.LightLayer;
public class TrackVisual extends AbstractBlockEntityVisual<TrackBlockEntity> { public class TrackVisual extends AbstractBlockEntityVisual<TrackBlockEntity> {
private final List<BezierTrackVisual> visuals; private final List<BezierTrackVisual> visuals = new ArrayList<>();
public TrackVisual(VisualizationContext context, TrackBlockEntity track, float partialTick) { public TrackVisual(VisualizationContext context, TrackBlockEntity track, float partialTick) {
super(context, track, partialTick); super(context, track, partialTick);
visuals = blockEntity.connections.values() collectConnections();
.stream()
.map(this::createInstance)
.filter(Objects::nonNull)
.toList();
} }
@Override @Override
@ -49,13 +46,22 @@ public class TrackVisual extends AbstractBlockEntityVisual<TrackBlockEntity> {
return; return;
_delete(); _delete();
collectConnections();
lightSections.sections(collectLightSections()); lightSections.sections(collectLightSections());
} }
private void collectConnections() {
blockEntity.connections.values()
.stream()
.map(this::createInstance)
.filter(Objects::nonNull)
.forEach(visuals::add);
}
@Override @Override
public void updateLight(float partialTick) { public void updateLight(float partialTick) {
if (visuals == null)
return;
visuals.forEach(BezierTrackVisual::updateLight); visuals.forEach(BezierTrackVisual::updateLight);
} }
@ -68,9 +74,8 @@ public class TrackVisual extends AbstractBlockEntityVisual<TrackBlockEntity> {
@Override @Override
public void _delete() { public void _delete() {
if (visuals == null)
return;
visuals.forEach(BezierTrackVisual::delete); visuals.forEach(BezierTrackVisual::delete);
visuals.clear();
} }
public LongSet collectLightSections() { public LongSet collectLightSections() {
@ -102,8 +107,6 @@ public class TrackVisual extends AbstractBlockEntityVisual<TrackBlockEntity> {
@Override @Override
public void collectCrumblingInstances(Consumer<Instance> consumer) { public void collectCrumblingInstances(Consumer<Instance> consumer) {
if (visuals == null)
return;
for (BezierTrackVisual instance : visuals) { for (BezierTrackVisual instance : visuals) {
instance.collectCrumblingInstances(consumer); instance.collectCrumblingInstances(consumer);
} }