From efedee7d486100eecebfaba3c30cd5ef81544e7c Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Thu, 16 Jan 2025 12:18:35 -0800 Subject: [PATCH] Confused diffuse - Fix bottom of chain conveyor guards not matching the bottom of chain conveyors - Bump flywheel build, add vanillin at runtime --- build.gradle | 1 + gradle.properties | 2 +- .../elevator/ElevatorPulleyVisual.java | 8 ++-- .../chainConveyor/ChainConveyorVisual.java | 3 +- .../content/trains/track/TrackVisual.java | 8 ++-- .../foundation/render/ShaderLightPartial.java | 38 ------------------ .../foundation/render/SpecialModels.java | 40 +++++++++++++++++++ 7 files changed, 52 insertions(+), 48 deletions(-) delete mode 100644 src/main/java/com/simibubi/create/foundation/render/ShaderLightPartial.java create mode 100644 src/main/java/com/simibubi/create/foundation/render/SpecialModels.java diff --git a/build.gradle b/build.gradle index 643dabec5f..54b988da43 100644 --- a/build.gradle +++ b/build.gradle @@ -191,6 +191,7 @@ dependencies { modCompileOnly("dev.engine_room.flywheel:flywheel-forge-api-${flywheel_minecraft_version}:${flywheel_version}") modRuntimeOnly("dev.engine_room.flywheel:flywheel-forge-${flywheel_minecraft_version}:${flywheel_version}") + modRuntimeOnly("dev.engine_room.vanillin:vanillin-forge-${flywheel_minecraft_version}:${flywheel_version}") if (catnipInWorkspace) { implementation project(":catnip:Common") diff --git a/gradle.properties b/gradle.properties index 3683163f44..70fbefaba0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -22,7 +22,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-177 +flywheel_version = 1.0.0-beta-182 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/contraptions/elevator/ElevatorPulleyVisual.java b/src/main/java/com/simibubi/create/content/contraptions/elevator/ElevatorPulleyVisual.java index 5678ab1470..ee76dec47f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/elevator/ElevatorPulleyVisual.java +++ b/src/main/java/com/simibubi/create/content/contraptions/elevator/ElevatorPulleyVisual.java @@ -11,7 +11,7 @@ import com.simibubi.create.content.contraptions.pulley.PulleyRenderer; import com.simibubi.create.content.kinetics.base.ShaftVisual; import com.simibubi.create.content.processing.burner.ScrollInstance; import com.simibubi.create.foundation.render.AllInstanceTypes; -import com.simibubi.create.foundation.render.ShaderLightPartial; +import com.simibubi.create.foundation.render.SpecialModels; import dev.engine_room.flywheel.api.visual.DynamicVisual; import dev.engine_room.flywheel.api.visual.ShaderLightVisual; @@ -54,13 +54,13 @@ public class ElevatorPulleyVisual extends ShaftVisual topSection = SectionPos.of(pos).asLong(); belt = new InstanceRecycler<>(() -> context.instancerProvider() - .instancer(AllInstanceTypes.SCROLLING, ShaderLightPartial.flat(AllPartialModels.ELEVATOR_BELT)) + .instancer(AllInstanceTypes.SCROLLING, SpecialModels.flatLit(AllPartialModels.ELEVATOR_BELT)) .createInstance() .rotation(rotation) .setSpriteShift(AllSpriteShifts.ELEVATOR_BELT)); halfBelt = context.instancerProvider() - .instancer(AllInstanceTypes.SCROLLING, ShaderLightPartial.flat(AllPartialModels.ELEVATOR_BELT_HALF)) + .instancer(AllInstanceTypes.SCROLLING, SpecialModels.flatLit(AllPartialModels.ELEVATOR_BELT_HALF)) .createInstance() .rotation(rotation) .setSpriteShift(AllSpriteShifts.ELEVATOR_BELT); @@ -75,7 +75,7 @@ public class ElevatorPulleyVisual extends ShaftVisual coil.setChanged(); magnet = context.instancerProvider() - .instancer(InstanceTypes.TRANSFORMED, ShaderLightPartial.flat(AllPartialModels.ELEVATOR_MAGNET)) + .instancer(InstanceTypes.TRANSFORMED, SpecialModels.flatLit(AllPartialModels.ELEVATOR_MAGNET)) .createInstance(); // Cache the magnet's transform to avoid recalculating this unchanging bit every frame diff --git a/src/main/java/com/simibubi/create/content/kinetics/chainConveyor/ChainConveyorVisual.java b/src/main/java/com/simibubi/create/content/kinetics/chainConveyor/ChainConveyorVisual.java index b3aca74516..431792846b 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/chainConveyor/ChainConveyorVisual.java +++ b/src/main/java/com/simibubi/create/content/kinetics/chainConveyor/ChainConveyorVisual.java @@ -7,6 +7,7 @@ import java.util.Map; import com.simibubi.create.AllPartialModels; import com.simibubi.create.content.kinetics.base.SingleRotatingVisual; import com.simibubi.create.content.logistics.box.PackageItem; +import com.simibubi.create.foundation.render.SpecialModels; import dev.engine_room.flywheel.api.model.Model; import dev.engine_room.flywheel.api.visual.DynamicVisual; @@ -147,7 +148,7 @@ public class ChainConveyorVisual extends SingleRotatingVisual imp TrackMaterial.TrackModelHolder modelHolder = bc.getMaterial().getModelHolder(); - instancerProvider().instancer(InstanceTypes.TRANSFORMED, ShaderLightPartial.flat(modelHolder.tie())) + instancerProvider().instancer(InstanceTypes.TRANSFORMED, SpecialModels.flatChunk(modelHolder.tie())) .createInstances(ties); - instancerProvider().instancer(InstanceTypes.TRANSFORMED, ShaderLightPartial.flat(modelHolder.leftSegment())) + instancerProvider().instancer(InstanceTypes.TRANSFORMED, SpecialModels.flatChunk(modelHolder.leftSegment())) .createInstances(left); - instancerProvider().instancer(InstanceTypes.TRANSFORMED, ShaderLightPartial.flat(modelHolder.rightSegment())) + instancerProvider().instancer(InstanceTypes.TRANSFORMED, SpecialModels.flatChunk(modelHolder.rightSegment())) .createInstances(right); SegmentAngles[] segments = bc.getBakedSegments(); diff --git a/src/main/java/com/simibubi/create/foundation/render/ShaderLightPartial.java b/src/main/java/com/simibubi/create/foundation/render/ShaderLightPartial.java deleted file mode 100644 index c71e136447..0000000000 --- a/src/main/java/com/simibubi/create/foundation/render/ShaderLightPartial.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.simibubi.create.foundation.render; - -import org.jetbrains.annotations.Nullable; - -import dev.engine_room.flywheel.api.material.LightShader; -import dev.engine_room.flywheel.api.model.Model; -import dev.engine_room.flywheel.lib.material.LightShaders; -import dev.engine_room.flywheel.lib.material.SimpleMaterial; -import dev.engine_room.flywheel.lib.model.ModelUtil; -import dev.engine_room.flywheel.lib.model.baked.BakedModelBuilder; -import dev.engine_room.flywheel.lib.model.baked.PartialModel; -import dev.engine_room.flywheel.lib.util.RendererReloadCache; -import net.minecraft.client.renderer.RenderType; - -public class ShaderLightPartial { - private static final RendererReloadCache FLAT = new RendererReloadCache<>(it -> BakedModelBuilder.create(it.get()) - .materialFunc((renderType, aBoolean) -> getMaterial(renderType, aBoolean, LightShaders.FLAT)) - .build()); - - private static final RendererReloadCache SMOOTH = new RendererReloadCache<>(it -> BakedModelBuilder.create(it.get()) - .materialFunc((renderType, aBoolean) -> getMaterial(renderType, aBoolean, LightShaders.SMOOTH)) - .build()); - - public static Model flat(PartialModel partial) { - return FLAT.get(partial); - } - - @Nullable - private static SimpleMaterial getMaterial(RenderType renderType, Boolean aBoolean, LightShader lightShader) { - var material = ModelUtil.getMaterial(renderType, aBoolean); - if (material == null) { - return null; - } - return SimpleMaterial.builderOf(material) - .light(lightShader) - .build(); - } -} diff --git a/src/main/java/com/simibubi/create/foundation/render/SpecialModels.java b/src/main/java/com/simibubi/create/foundation/render/SpecialModels.java new file mode 100644 index 0000000000..145aa3d2b5 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/render/SpecialModels.java @@ -0,0 +1,40 @@ +package com.simibubi.create.foundation.render; + +import dev.engine_room.flywheel.api.material.CardinalLightingMode; +import dev.engine_room.flywheel.api.material.LightShader; +import dev.engine_room.flywheel.api.model.Model; +import dev.engine_room.flywheel.lib.material.LightShaders; +import dev.engine_room.flywheel.lib.material.SimpleMaterial; +import dev.engine_room.flywheel.lib.model.ModelUtil; +import dev.engine_room.flywheel.lib.model.baked.BakedModelBuilder; +import dev.engine_room.flywheel.lib.model.baked.PartialModel; +import dev.engine_room.flywheel.lib.util.RendererReloadCache; + +public class SpecialModels { + private static final RendererReloadCache FLAT = new RendererReloadCache<>(it -> BakedModelBuilder.create(it.partial.get()) + .materialFunc((renderType, aBoolean) -> { + var material = ModelUtil.getMaterial(renderType, aBoolean); + if (material == null) { + return null; + } + return SimpleMaterial.builderOf(material) + .light(it.light) + .cardinalLightingMode(it.cardinalLightingMode) + .build(); + }) + .build()); + + public static Model flatLit(PartialModel partial) { + return FLAT.get(new Key(partial, LightShaders.FLAT, CardinalLightingMode.ENTITY)); + } + + public static Model flatChunk(PartialModel partial) { + return FLAT.get(new Key(partial, LightShaders.FLAT, CardinalLightingMode.CHUNK)); + } + + public static Model chunkDiffuse(PartialModel partial) { + return FLAT.get(new Key(partial, LightShaders.SMOOTH_WHEN_EMBEDDED, CardinalLightingMode.CHUNK)); + } + + private record Key(PartialModel partial, LightShader light, CardinalLightingMode cardinalLightingMode) {} +}