diff --git a/gradle.properties b/gradle.properties index 5cb85d435..9a8adce4e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java index d46aeee5e..5a66c6d05 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/Contraption.java @@ -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 simplifiedEntityColliderProvider; // Client + public Map modelData; public Map presentTileEntities; public List maybeInstancedTileEntities; public List 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); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionRenderDispatcher.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionRenderDispatcher.java index c7bf1f36c..c6c5e30cf 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionRenderDispatcher.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionRenderDispatcher.java @@ -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 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); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/FlwContraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/FlwContraption.java index abc7b2c90..1149940a0 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/FlwContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/FlwContraption.java @@ -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 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)); } } diff --git a/src/main/java/com/simibubi/create/content/curiosities/bell/CustomRotationParticle.java b/src/main/java/com/simibubi/create/content/curiosities/bell/CustomRotationParticle.java index c0066d094..3f6d0ef2c 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/bell/CustomRotationParticle.java +++ b/src/main/java/com/simibubi/create/content/curiosities/bell/CustomRotationParticle.java @@ -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(); diff --git a/src/main/java/com/simibubi/create/foundation/render/SuperByteBuffer.java b/src/main/java/com/simibubi/create/foundation/render/SuperByteBuffer.java index 3942299fe..089029191 100644 --- a/src/main/java/com/simibubi/create/foundation/render/SuperByteBuffer.java +++ b/src/main/java/com/simibubi/create/foundation/render/SuperByteBuffer.java @@ -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, TStack