Final Flywheel Fixes

- Update Flywheel
- Resolve all remaining errors
This commit is contained in:
PepperCode1 2022-08-03 23:43:36 -07:00
parent 1797eddf0f
commit 4ea1f3e620
8 changed files with 28 additions and 35 deletions

View file

@ -21,7 +21,7 @@ parchment_version = 2022.07.10
# dependency versions
registrate_version = MC1.19-1.1.5
flywheel_minecraft_version = 1.19
flywheel_version = 0.6.4-1
flywheel_version = 0.6.4-2
jei_minecraft_version = 1.19
jei_version = 11.1.0.235
curios_minecraft_version = 1.19

View file

@ -56,7 +56,6 @@ public class DeployerFakePlayer extends FakePlayer {
public DeployerFakePlayer(ServerLevel world) {
super(world, DEPLOYER_PROFILE);
connection = new FakePlayNetHandler(world.getServer(), this);
this.playEquipSound(spawnedItemEffects);
}
@Override

View file

@ -15,7 +15,7 @@ import com.jozufozu.flywheel.event.ReloadRenderersEvent;
import com.jozufozu.flywheel.event.RenderLayerEvent;
import com.jozufozu.flywheel.util.WorldAttached;
import com.jozufozu.flywheel.util.transform.TransformStack;
import com.mojang.blaze3d.vertex.BufferBuilder;
import com.mojang.blaze3d.vertex.BufferBuilder.RenderedBuffer;
import com.mojang.blaze3d.vertex.PoseStack;
import com.simibubi.create.AllMovementBehaviours;
import com.simibubi.create.content.contraptions.components.structureMovement.AbstractContraptionEntity;
@ -171,11 +171,11 @@ public class ContraptionRenderDispatcher {
public static SuperByteBuffer buildStructureBuffer(VirtualRenderWorld renderWorld, Contraption c,
RenderType layer) {
Collection<StructureTemplate.StructureBlockInfo> values = c.getRenderedBlocks();
BufferBuilder builder = new WorldModelBuilder(layer).withRenderWorld(renderWorld)
com.jozufozu.flywheel.util.Pair<RenderedBuffer, Integer> pair = new WorldModelBuilder(layer).withRenderWorld(renderWorld)
.withBlocks(values)
.withModelData(c.modelData)
.build();
return new SuperByteBuffer(builder);
return new SuperByteBuffer(pair.first(), pair.second());
}
public static int getLight(Level world, float lx, float ly, float lz) {

View file

@ -29,7 +29,7 @@ public class BracketedKineticBlockModel extends BakedModelWrapper<BakedModel> {
@Override
public ModelData getModelData(BlockAndTintGetter world, BlockPos pos, BlockState state, ModelData tileData) {
if (isVirtual(tileData))
if (ModelUtil.isVirtual(tileData))
return tileData;
BracketedModelData data = new BracketedModelData();
BracketedTileEntityBehaviour attachmentBehaviour =
@ -42,7 +42,7 @@ public class BracketedKineticBlockModel extends BakedModelWrapper<BakedModel> {
@Override
public List<BakedQuad> getQuads(BlockState state, Direction side, RandomSource rand, ModelData data, RenderType renderType) {
if (!isVirtual(data)) {
if (!ModelUtil.isVirtual(data)) {
if (data.has(BRACKET_PROPERTY)) {
BracketedModelData pipeData = data.get(BRACKET_PROPERTY);
BakedModel bracket = pipeData.getBracket();
@ -54,11 +54,6 @@ public class BracketedKineticBlockModel extends BakedModelWrapper<BakedModel> {
return super.getQuads(state, side, rand, data, renderType);
}
// TODO 1.19: move to Flywheel's ModelUtil
private static boolean isVirtual(ModelData data) {
return data.has(ModelUtil.VIRTUAL_PROPERTY) && data.get(ModelUtil.VIRTUAL_PROPERTY);
}
private static class BracketedModelData {
private BakedModel bracket;

View file

@ -4,9 +4,10 @@ import java.util.LinkedHashMap;
import java.util.Map;
import com.jozufozu.flywheel.core.model.ModelUtil;
import com.jozufozu.flywheel.core.model.ShadeSeparatedBufferBuilder;
import com.jozufozu.flywheel.core.model.ShadeSeparatingVertexConsumer;
import com.jozufozu.flywheel.util.Pair;
import com.mojang.blaze3d.vertex.BufferBuilder;
import com.mojang.blaze3d.vertex.BufferBuilder.RenderedBuffer;
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexFormat;
@ -100,7 +101,7 @@ public class SchematicRenderer {
BoundingBox bounds = renderWorld.getBounds();
ShadeSeparatingVertexConsumer shadeSeparatingWrapper = objects.shadeSeparatingWrapper;
ShadeSeparatedBufferBuilder builder = new ShadeSeparatedBufferBuilder(512);
BufferBuilder builder = new BufferBuilder(512);
BufferBuilder unshadedBuilder = objects.unshadedBuilder;
builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK);
@ -132,13 +133,11 @@ public class SchematicRenderer {
ModelBlockRenderer.clearCache();
shadeSeparatingWrapper.clear();
unshadedBuilder.end();
builder.appendUnshadedVertices(unshadedBuilder);
builder.end();
Pair<RenderedBuffer, Integer> pair = ModelUtil.endShadeSeparated(builder, unshadedBuilder);
renderWorld.renderMode = false;
return new SuperByteBuffer(builder);
return new SuperByteBuffer(pair.first(), pair.second());
}
private static int getLayerCount() {

View file

@ -7,10 +7,10 @@ import java.util.Map.Entry;
import java.util.function.Consumer;
import com.jozufozu.flywheel.core.model.ModelUtil;
import com.jozufozu.flywheel.core.model.ShadeSeparatedBufferBuilder;
import com.jozufozu.flywheel.core.model.ShadeSeparatingVertexConsumer;
import com.jozufozu.flywheel.util.transform.TransformStack;
import com.mojang.blaze3d.vertex.BufferBuilder;
import com.mojang.blaze3d.vertex.BufferBuilder.RenderedBuffer;
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.SheetedDecalTextureGenerator;
@ -418,7 +418,7 @@ public class WorldSectionElement extends AnimatedSceneElement {
PoseStack poseStack = objects.poseStack;
RandomSource random = objects.random;
ShadeSeparatingVertexConsumer shadeSeparatingWrapper = objects.shadeSeparatingWrapper;
ShadeSeparatedBufferBuilder builder = new ShadeSeparatedBufferBuilder(512);
BufferBuilder builder = new BufferBuilder(512);
BufferBuilder unshadedBuilder = objects.unshadedBuilder;
builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK);
@ -455,11 +455,9 @@ public class WorldSectionElement extends AnimatedSceneElement {
world.clearMask();
shadeSeparatingWrapper.clear();
unshadedBuilder.end();
builder.appendUnshadedVertices(unshadedBuilder);
builder.end();
com.jozufozu.flywheel.util.Pair<RenderedBuffer, Integer> pair = ModelUtil.endShadeSeparated(builder, unshadedBuilder);
return new SuperByteBuffer(builder);
return new SuperByteBuffer(pair.first(), pair.second());
}
private static class ThreadLocalObjects {

View file

@ -1,7 +1,8 @@
package com.simibubi.create.foundation.render;
import com.jozufozu.flywheel.core.model.ModelUtil;
import com.mojang.blaze3d.vertex.BufferBuilder;
import com.jozufozu.flywheel.util.Pair;
import com.mojang.blaze3d.vertex.BufferBuilder.RenderedBuffer;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Minecraft;
@ -22,8 +23,8 @@ public class BakedModelRenderHelper {
}
public static SuperByteBuffer standardModelRender(BakedModel model, BlockState referenceState, PoseStack ms) {
BufferBuilder builder = ModelUtil.getBufferBuilder(model, referenceState, ms);
return new SuperByteBuffer(builder);
Pair<RenderedBuffer, Integer> pair = ModelUtil.getBufferBuilder(model, referenceState, ms);
return new SuperByteBuffer(pair.first(), pair.second());
}
}

View file

@ -5,12 +5,12 @@ import java.util.function.IntPredicate;
import com.jozufozu.flywheel.api.vertex.ShadedVertexList;
import com.jozufozu.flywheel.api.vertex.VertexList;
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;
import com.jozufozu.flywheel.util.transform.TStack;
import com.jozufozu.flywheel.util.transform.Transform;
import com.mojang.blaze3d.vertex.BufferBuilder;
import com.mojang.blaze3d.vertex.BufferBuilder.DrawState;
import com.mojang.blaze3d.vertex.BufferBuilder.RenderedBuffer;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Matrix3f;
@ -66,13 +66,14 @@ public class SuperByteBuffer implements Transform<SuperByteBuffer>, TStack<Super
// Temporary
private static final Long2IntMap WORLD_LIGHT_CACHE = new Long2IntOpenHashMap();
public SuperByteBuffer(BufferBuilder buf) {
if (buf instanceof ShadeSeparatedBufferBuilder separated) {
ShadedVertexList template = new BlockVertexList.Shaded(separated);
shadedPredicate = template::isShaded;
public SuperByteBuffer(RenderedBuffer buf, int unshadedStartVertex) {
if (buf != null) {
DrawState drawState = buf.drawState();
ShadedVertexList template = new BlockVertexList.Shaded(buf.vertexBuffer(), drawState.vertexCount(), drawState.format().getVertexSize(), unshadedStartVertex);
this.template = template;
shadedPredicate = template::isShaded;
} else {
template = new BlockVertexList(buf);
this.template = null;
shadedPredicate = index -> true;
}
transforms = new PoseStack();
@ -233,7 +234,7 @@ public class SuperByteBuffer implements Transform<SuperByteBuffer>, TStack<Super
}
public boolean isEmpty() {
return template.isEmpty();
return template == null || template.isEmpty();
}
public PoseStack getTransforms() {