Merge branch 'mc1.18/dev' of https://github.com/Creators-of-Create/Create into mc1.18/dev

This commit is contained in:
simibubi 2022-07-11 21:40:59 +02:00
commit cd5b8ef830
6 changed files with 21 additions and 10 deletions

View file

@ -19,7 +19,7 @@ parchment_version = 2022.07.10
# dependency versions # dependency versions
registrate_version = MC1.18.2-1.1.3 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_minecraft_version = 1.18.2
jei_version = 9.5.3.143 jei_version = 9.5.3.143
curios_minecraft_version = 1.18.2 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.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.model.data.IModelData;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.IItemHandlerModifiable;
@ -147,6 +148,7 @@ public abstract class Contraption {
private CompletableFuture<Void> simplifiedEntityColliderProvider; private CompletableFuture<Void> simplifiedEntityColliderProvider;
// Client // Client
public Map<BlockPos, IModelData> modelData;
public Map<BlockPos, BlockEntity> presentTileEntities; public Map<BlockPos, BlockEntity> presentTileEntities;
public List<BlockEntity> maybeInstancedTileEntities; public List<BlockEntity> maybeInstancedTileEntities;
public List<BlockEntity> specialRenderedTileEntities; public List<BlockEntity> specialRenderedTileEntities;
@ -158,6 +160,7 @@ public abstract class Contraption {
blocks = new HashMap<>(); blocks = new HashMap<>();
seats = new ArrayList<>(); seats = new ArrayList<>();
actors = new ArrayList<>(); actors = new ArrayList<>();
modelData = new HashMap<>();
interactors = new HashMap<>(); interactors = new HashMap<>();
superglue = new ArrayList<>(); superglue = new ArrayList<>();
seatMapping = new HashMap<>(); seatMapping = new HashMap<>();
@ -871,8 +874,9 @@ public abstract class Contraption {
if (te == null) if (te == null)
return; return;
te.setLevel(world); te.setLevel(world);
if (te instanceof KineticTileEntity) modelData.put(info.pos, te.getModelData());
((KineticTileEntity) te).setSpeed(0); if (te instanceof KineticTileEntity kte)
kte.setSpeed(0);
te.getBlockState(); te.getBlockState();
MovementBehaviour movementBehaviour = AllMovementBehaviours.getBehaviour(info.state); 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.Backend;
import com.jozufozu.flywheel.backend.gl.error.GlError; import com.jozufozu.flywheel.backend.gl.error.GlError;
import com.jozufozu.flywheel.config.BackendType; 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.core.virtual.VirtualRenderWorld;
import com.jozufozu.flywheel.event.BeginFrameEvent; import com.jozufozu.flywheel.event.BeginFrameEvent;
import com.jozufozu.flywheel.event.GatherContextEvent; import com.jozufozu.flywheel.event.GatherContextEvent;
@ -171,7 +171,10 @@ public class ContraptionRenderDispatcher {
public static SuperByteBuffer buildStructureBuffer(VirtualRenderWorld renderWorld, Contraption c, public static SuperByteBuffer buildStructureBuffer(VirtualRenderWorld renderWorld, Contraption c,
RenderType layer) { RenderType layer) {
Collection<StructureTemplate.StructureBlockInfo> values = c.getRenderedBlocks(); 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); 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.backend.model.ArrayModelRenderer;
import com.jozufozu.flywheel.core.model.Model; import com.jozufozu.flywheel.core.model.Model;
import com.jozufozu.flywheel.core.model.WorldModel; 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.core.virtual.VirtualRenderWorld;
import com.jozufozu.flywheel.event.BeginFrameEvent; import com.jozufozu.flywheel.event.BeginFrameEvent;
import com.jozufozu.flywheel.event.RenderLayerEvent; import com.jozufozu.flywheel.event.RenderLayerEvent;
@ -141,7 +142,10 @@ public class FlwContraption extends ContraptionRenderInfo {
Collection<StructureBlockInfo> renderedBlocks = contraption.getRenderedBlocks(); Collection<StructureBlockInfo> renderedBlocks = contraption.getRenderedBlocks();
for (RenderType layer : blockLayers) { 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)); renderLayers.put(layer, new ArrayModelRenderer(layerModel));
} }
} }

View file

@ -1,6 +1,6 @@
package com.simibubi.create.content.curiosities.bell; 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.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Quaternion; import com.mojang.math.Quaternion;
import com.mojang.math.Vector3f; import com.mojang.math.Vector3f;
@ -63,7 +63,7 @@ public class CustomRotationParticle extends SimpleAnimatedParticle {
float maxU = mirror ? getU0() : getU1(); float maxU = mirror ? getU0() : getU1();
float minV = getV0(); float minV = getV0();
float maxV = getV1(); 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[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[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(); 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.ShadedVertexList;
import com.jozufozu.flywheel.api.vertex.VertexList; 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.model.ShadeSeparatedBufferBuilder;
import com.jozufozu.flywheel.core.vertex.BlockVertexList; import com.jozufozu.flywheel.core.vertex.BlockVertexList;
import com.jozufozu.flywheel.util.DiffuseLightCalculator; import com.jozufozu.flywheel.util.DiffuseLightCalculator;
@ -114,7 +114,7 @@ public class SuperByteBuffer implements Transform<SuperByteBuffer>, TStack<Super
DiffuseLightCalculator diffuseCalculator = ForcedDiffuseState.getForcedCalculator(); DiffuseLightCalculator diffuseCalculator = ForcedDiffuseState.getForcedCalculator();
final boolean disableDiffuseMult = final boolean disableDiffuseMult =
this.disableDiffuseMult || (OptifineHandler.isUsingShaders() && diffuseCalculator == null); this.disableDiffuseMult || (ShadersModHandler.isShaderPackInUse() && diffuseCalculator == null);
if (diffuseCalculator == null) { if (diffuseCalculator == null) {
diffuseCalculator = this.diffuseCalculator; diffuseCalculator = this.diffuseCalculator;
if (diffuseCalculator == null) { if (diffuseCalculator == null) {