Confused diffuse

- Fix bottom of chain conveyor guards not matching the bottom of chain
  conveyors
- Bump flywheel build, add vanillin at runtime
This commit is contained in:
Jozufozu 2025-01-16 12:18:35 -08:00
parent 9be39b7f3b
commit efedee7d48
7 changed files with 52 additions and 48 deletions

View file

@ -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")

View file

@ -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

View file

@ -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<ElevatorPulleyBlockEntity>
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<ElevatorPulleyBlockEntity>
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

View file

@ -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<ChainConveyorBlock
private void setupGuards() {
deleteGuards();
var guardInstancer = instancerProvider().instancer(InstanceTypes.TRANSFORMED, Models.partial(AllPartialModels.CHAIN_CONVEYOR_GUARD));
var guardInstancer = instancerProvider().instancer(InstanceTypes.TRANSFORMED, SpecialModels.chunkDiffuse(AllPartialModels.CHAIN_CONVEYOR_GUARD));
for (BlockPos blockPos : blockEntity.connections) {
ChainConveyorBlockEntity.ConnectionStats stats = blockEntity.connectionStats.get(blockPos);

View file

@ -13,7 +13,7 @@ import com.simibubi.create.AllPartialModels;
import com.simibubi.create.content.contraptions.render.ContraptionVisual;
import com.simibubi.create.content.trains.track.BezierConnection.GirderAngles;
import com.simibubi.create.content.trains.track.BezierConnection.SegmentAngles;
import com.simibubi.create.foundation.render.ShaderLightPartial;
import com.simibubi.create.foundation.render.SpecialModels;
import dev.engine_room.flywheel.api.instance.Instance;
import dev.engine_room.flywheel.api.visual.ShaderLightVisual;
@ -157,11 +157,11 @@ public class TrackVisual extends AbstractBlockEntityVisual<TrackBlockEntity> 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();

View file

@ -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<PartialModel, Model> FLAT = new RendererReloadCache<>(it -> BakedModelBuilder.create(it.get())
.materialFunc((renderType, aBoolean) -> getMaterial(renderType, aBoolean, LightShaders.FLAT))
.build());
private static final RendererReloadCache<PartialModel, Model> 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();
}
}

View file

@ -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<Key, Model> 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) {}
}