From 4ea1f3e620481b30948830d1996026cef45c8ecb Mon Sep 17 00:00:00 2001 From: PepperCode1 <44146161+PepperCode1@users.noreply.github.com> Date: Wed, 3 Aug 2022 23:43:36 -0700 Subject: [PATCH] Final Flywheel Fixes - Update Flywheel - Resolve all remaining errors --- gradle.properties | 2 +- .../components/deployer/DeployerFakePlayer.java | 1 - .../render/ContraptionRenderDispatcher.java | 6 +++--- .../elementary/BracketedKineticBlockModel.java | 9 ++------- .../schematics/client/SchematicRenderer.java | 11 +++++------ .../ponder/element/WorldSectionElement.java | 10 ++++------ .../render/BakedModelRenderHelper.java | 7 ++++--- .../foundation/render/SuperByteBuffer.java | 17 +++++++++-------- 8 files changed, 28 insertions(+), 35 deletions(-) diff --git a/gradle.properties b/gradle.properties index eb49608b9..47ba5fd88 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerFakePlayer.java b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerFakePlayer.java index 5d820649d..b6d72d72d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerFakePlayer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerFakePlayer.java @@ -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 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 c6c5e30cf..891de4d75 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 @@ -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 values = c.getRenderedBlocks(); - BufferBuilder builder = new WorldModelBuilder(layer).withRenderWorld(renderWorld) + com.jozufozu.flywheel.util.Pair 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) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/BracketedKineticBlockModel.java b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/BracketedKineticBlockModel.java index 8fca03003..0872227c1 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/BracketedKineticBlockModel.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/BracketedKineticBlockModel.java @@ -29,7 +29,7 @@ public class BracketedKineticBlockModel extends BakedModelWrapper { @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 { @Override public List 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 { 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; diff --git a/src/main/java/com/simibubi/create/content/schematics/client/SchematicRenderer.java b/src/main/java/com/simibubi/create/content/schematics/client/SchematicRenderer.java index fbc086362..ffce00ef3 100644 --- a/src/main/java/com/simibubi/create/content/schematics/client/SchematicRenderer.java +++ b/src/main/java/com/simibubi/create/content/schematics/client/SchematicRenderer.java @@ -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 pair = ModelUtil.endShadeSeparated(builder, unshadedBuilder); renderWorld.renderMode = false; - return new SuperByteBuffer(builder); + return new SuperByteBuffer(pair.first(), pair.second()); } private static int getLayerCount() { diff --git a/src/main/java/com/simibubi/create/foundation/ponder/element/WorldSectionElement.java b/src/main/java/com/simibubi/create/foundation/ponder/element/WorldSectionElement.java index 4d54b7580..bd00f1d8c 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/element/WorldSectionElement.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/element/WorldSectionElement.java @@ -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 pair = ModelUtil.endShadeSeparated(builder, unshadedBuilder); - return new SuperByteBuffer(builder); + return new SuperByteBuffer(pair.first(), pair.second()); } private static class ThreadLocalObjects { diff --git a/src/main/java/com/simibubi/create/foundation/render/BakedModelRenderHelper.java b/src/main/java/com/simibubi/create/foundation/render/BakedModelRenderHelper.java index aa8300cde..c5e675c7e 100644 --- a/src/main/java/com/simibubi/create/foundation/render/BakedModelRenderHelper.java +++ b/src/main/java/com/simibubi/create/foundation/render/BakedModelRenderHelper.java @@ -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 pair = ModelUtil.getBufferBuilder(model, referenceState, ms); + return new SuperByteBuffer(pair.first(), pair.second()); } } 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 089029191..0419b5d39 100644 --- a/src/main/java/com/simibubi/create/foundation/render/SuperByteBuffer.java +++ b/src/main/java/com/simibubi/create/foundation/render/SuperByteBuffer.java @@ -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, TStack true; } transforms = new PoseStack(); @@ -233,7 +234,7 @@ public class SuperByteBuffer implements Transform, TStack