Contraption's runway debut

- Contraptions support modeldata
 - Fixes issue where the wrong casing appeared on belts assembled to contraptions
 - Bump flywheel build
This commit is contained in:
Jozufozu 2022-07-11 14:37:26 -04:00
parent 3153ad2100
commit ef24999e31
6 changed files with 21 additions and 10 deletions

View File

@ -19,7 +19,7 @@ parchment_version = 2022.07.10
# dependency versions
registrate_version = MC1.18.2-1.1.3
flywheel_version = 1.18-0.6.4.83
flywheel_version = 1.18-0.6.4.86
jei_minecraft_version = 1.18.2
jei_version = 9.5.3.143
curios_minecraft_version = 1.18.2

View File

@ -115,6 +115,7 @@ import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.model.data.IModelData;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.items.IItemHandlerModifiable;
@ -147,6 +148,7 @@ public abstract class Contraption {
private CompletableFuture<Void> simplifiedEntityColliderProvider;
// Client
public Map<BlockPos, IModelData> modelData;
public Map<BlockPos, BlockEntity> presentTileEntities;
public List<BlockEntity> maybeInstancedTileEntities;
public List<BlockEntity> specialRenderedTileEntities;
@ -158,6 +160,7 @@ public abstract class Contraption {
blocks = new HashMap<>();
seats = new ArrayList<>();
actors = new ArrayList<>();
modelData = new HashMap<>();
interactors = new HashMap<>();
superglue = new ArrayList<>();
seatMapping = new HashMap<>();
@ -871,8 +874,9 @@ public abstract class Contraption {
if (te == null)
return;
te.setLevel(world);
if (te instanceof KineticTileEntity)
((KineticTileEntity) te).setSpeed(0);
modelData.put(info.pos, te.getModelData());
if (te instanceof KineticTileEntity kte)
kte.setSpeed(0);
te.getBlockState();
MovementBehaviour movementBehaviour = AllMovementBehaviours.getBehaviour(info.state);

View File

@ -7,7 +7,7 @@ import org.apache.commons.lang3.tuple.Pair;
import com.jozufozu.flywheel.backend.Backend;
import com.jozufozu.flywheel.backend.gl.error.GlError;
import com.jozufozu.flywheel.config.BackendType;
import com.jozufozu.flywheel.core.model.ModelUtil;
import com.jozufozu.flywheel.core.model.WorldModelBuilder;
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
import com.jozufozu.flywheel.event.BeginFrameEvent;
import com.jozufozu.flywheel.event.GatherContextEvent;
@ -171,7 +171,10 @@ public class ContraptionRenderDispatcher {
public static SuperByteBuffer buildStructureBuffer(VirtualRenderWorld renderWorld, Contraption c,
RenderType layer) {
Collection<StructureTemplate.StructureBlockInfo> values = c.getRenderedBlocks();
BufferBuilder builder = ModelUtil.getBufferBuilderFromTemplate(renderWorld, layer, values);
BufferBuilder builder = new WorldModelBuilder(layer).withRenderWorld(renderWorld)
.withBlocks(values)
.withModelData(c.modelData)
.build();
return new SuperByteBuffer(builder);
}

View File

@ -15,6 +15,7 @@ import com.jozufozu.flywheel.backend.instancing.instancing.InstancingEngine;
import com.jozufozu.flywheel.backend.model.ArrayModelRenderer;
import com.jozufozu.flywheel.core.model.Model;
import com.jozufozu.flywheel.core.model.WorldModel;
import com.jozufozu.flywheel.core.model.WorldModelBuilder;
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
import com.jozufozu.flywheel.event.BeginFrameEvent;
import com.jozufozu.flywheel.event.RenderLayerEvent;
@ -141,7 +142,10 @@ public class FlwContraption extends ContraptionRenderInfo {
Collection<StructureBlockInfo> renderedBlocks = contraption.getRenderedBlocks();
for (RenderType layer : blockLayers) {
Model layerModel = new WorldModel(renderWorld, layer, renderedBlocks, layer + "_" + contraption.entity.getId());
Model layerModel = new WorldModelBuilder(layer).withRenderWorld(renderWorld)
.withModelData(contraption.modelData)
.withBlocks(renderedBlocks)
.intoMesh(layer + "_" + contraption.entity.getId());
renderLayers.put(layer, new ArrayModelRenderer(layerModel));
}
}

View File

@ -1,6 +1,6 @@
package com.simibubi.create.content.curiosities.bell;
import com.jozufozu.flywheel.backend.OptifineHandler;
import com.jozufozu.flywheel.backend.ShadersModHandler;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Quaternion;
import com.mojang.math.Vector3f;
@ -63,7 +63,7 @@ public class CustomRotationParticle extends SimpleAnimatedParticle {
float maxU = mirror ? getU0() : getU1();
float minV = getV0();
float maxV = getV1();
int brightness = OptifineHandler.isUsingShaders() ? LightTexture.pack(12, 15) : getLightColor(partialTicks);
int brightness = ShadersModHandler.isShaderPackInUse() ? LightTexture.pack(12, 15) : getLightColor(partialTicks);
builder.vertex(vertices[0].x(), vertices[0].y(), vertices[0].z()).uv(maxU, maxV).color(rCol, gCol, bCol, alpha).uv2(brightness).endVertex();
builder.vertex(vertices[1].x(), vertices[1].y(), vertices[1].z()).uv(maxU, minV).color(rCol, gCol, bCol, alpha).uv2(brightness).endVertex();
builder.vertex(vertices[2].x(), vertices[2].y(), vertices[2].z()).uv(minU, minV).color(rCol, gCol, bCol, alpha).uv2(brightness).endVertex();

View File

@ -4,7 +4,7 @@ import java.util.function.IntPredicate;
import com.jozufozu.flywheel.api.vertex.ShadedVertexList;
import com.jozufozu.flywheel.api.vertex.VertexList;
import com.jozufozu.flywheel.backend.OptifineHandler;
import com.jozufozu.flywheel.backend.ShadersModHandler;
import com.jozufozu.flywheel.core.model.ShadeSeparatedBufferBuilder;
import com.jozufozu.flywheel.core.vertex.BlockVertexList;
import com.jozufozu.flywheel.util.DiffuseLightCalculator;
@ -114,7 +114,7 @@ public class SuperByteBuffer implements Transform<SuperByteBuffer>, TStack<Super
DiffuseLightCalculator diffuseCalculator = ForcedDiffuseState.getForcedCalculator();
final boolean disableDiffuseMult =
this.disableDiffuseMult || (OptifineHandler.isUsingShaders() && diffuseCalculator == null);
this.disableDiffuseMult || (ShadersModHandler.isShaderPackInUse() && diffuseCalculator == null);
if (diffuseCalculator == null) {
diffuseCalculator = this.diffuseCalculator;
if (diffuseCalculator == null) {