diff --git a/build.gradle b/build.gradle index 7431fc5b1..b7a987060 100644 --- a/build.gradle +++ b/build.gradle @@ -33,8 +33,7 @@ java.toolchain.languageVersion = JavaLanguageVersion.of(17) println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) minecraft { -// mappings channel: 'parchment', version: "${parchment_version}-${minecraft_version}" - mappings channel: 'official', version: "${minecraft_version}" + mappings channel: 'parchment', version: "${parchment_version}-${minecraft_version}" runs { client { @@ -114,8 +113,8 @@ dependencies { // switch to implementation for debugging compileOnly fg.deobf("maven.modrinth:starlight-forge:1.0.2+1.18.2") - compileOnly fg.deobf("maven.modrinth:rubidium:0.5.2a") - compileOnly fg.deobf("curse.maven:oculus-581495:3821406") + compileOnly fg.deobf("maven.modrinth:rubidium:0.6.1") + compileOnly fg.deobf("maven.modrinth:oculus:1.19-1.2.5a") // https://discord.com/channels/313125603924639766/725850371834118214/910619168821354497 // Prevent Mixin annotation processor from getting into IntelliJ's annotation processor settings diff --git a/gradle.properties b/gradle.properties index ac6d2dace..52eec945d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,10 +3,10 @@ org.gradle.daemon = false # mod version info mod_version = 0.6.5 -artifact_minecraft_version = 1.19 +artifact_minecraft_version = 1.19.2 -minecraft_version = 1.19 -forge_version = 41.0.94 +minecraft_version = 1.19.2 +forge_version = 43.0.8 # build dependency versions forgegradle_version = 5.1.53 @@ -14,7 +14,7 @@ mixingradle_version = 0.7-SNAPSHOT mixin_version = 0.8.5 librarian_version = 1.+ cursegradle_version = 1.4.0 -parchment_version = 2022.07.10 +parchment_version = 2022.08.10 # curseforge info projectId = 486392 diff --git a/src/main/java/com/jozufozu/flywheel/backend/gl/GlStateTracker.java b/src/main/java/com/jozufozu/flywheel/backend/gl/GlStateTracker.java index eec0a4cf8..22e7eabff 100644 --- a/src/main/java/com/jozufozu/flywheel/backend/gl/GlStateTracker.java +++ b/src/main/java/com/jozufozu/flywheel/backend/gl/GlStateTracker.java @@ -44,6 +44,10 @@ public class GlStateTracker { public void restore() { GlBufferType[] values = GlBufferType.values(); + if (GlStateTracker.vao != 0) { + GlStateManager._glBindVertexArray(0); + } + for (int i = 0; i < values.length; i++) { if (buffers[i] != GlStateTracker.buffers[i]) { GlStateManager._glBindBuffer(values[i].glEnum, buffers[i]); diff --git a/src/main/java/com/jozufozu/flywheel/core/PartialModel.java b/src/main/java/com/jozufozu/flywheel/core/PartialModel.java index 526239b48..846c5cfbc 100644 --- a/src/main/java/com/jozufozu/flywheel/core/PartialModel.java +++ b/src/main/java/com/jozufozu/flywheel/core/PartialModel.java @@ -14,7 +14,7 @@ import net.minecraftforge.client.event.ModelEvent; * Creating a PartialModel will make the associated modelLocation automatically load. * PartialModels must be initialized during {@link net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent FMLClientSetupEvent}. *
- * Once {@link ModelBakeEvent} finishes, all PartialModels (with valid modelLocations) + * Once {@link ModelEvent.BakingCompleted} finishes, all PartialModels (with valid modelLocations) * will have their bakedModel fields populated. *
* Attempting to create a PartialModel after ModelRegistryEvent will cause an error. diff --git a/src/main/java/com/jozufozu/flywheel/core/model/BlockModel.java b/src/main/java/com/jozufozu/flywheel/core/model/BlockModel.java index 158806e7a..63054a3ef 100644 --- a/src/main/java/com/jozufozu/flywheel/core/model/BlockModel.java +++ b/src/main/java/com/jozufozu/flywheel/core/model/BlockModel.java @@ -56,17 +56,10 @@ public class BlockModel implements Model { this.name = name; RenderedBuffer renderedBuffer = pair.first(); - if (renderedBuffer == null) { - reader = null; - eboSupplier = () -> null; - return; - } - BufferBuilder.DrawState drawState = renderedBuffer.drawState(); - reader = Formats.BLOCK.createReader(renderedBuffer, pair.second()); - if (drawState.sequentialIndex()) { + if (!drawState.sequentialIndex()) { ByteBuffer src = renderedBuffer.indexBuffer(); ByteBuffer indexBuffer = MemoryTracker.create(src.capacity()); MemoryUtil.memCopy(src, indexBuffer); diff --git a/src/main/java/com/jozufozu/flywheel/core/model/ModelUtil.java b/src/main/java/com/jozufozu/flywheel/core/model/ModelUtil.java index 57d8aaeea..4b58ba1e5 100644 --- a/src/main/java/com/jozufozu/flywheel/core/model/ModelUtil.java +++ b/src/main/java/com/jozufozu/flywheel/core/model/ModelUtil.java @@ -67,7 +67,7 @@ public class ModelUtil { // FIXME: Unshaded indices ((BufferBuilderExtension) shadedBuilder).flywheel$appendBufferUnsafe(unshadedBuffer.vertexBuffer()); } - RenderedBuffer buffer = shadedBuilder.endOrDiscardIfEmpty(); + RenderedBuffer buffer = shadedBuilder.end(); return Pair.of(buffer, unshadedStartVertex); } diff --git a/src/main/java/com/jozufozu/flywheel/core/vertex/BlockVertex.java b/src/main/java/com/jozufozu/flywheel/core/vertex/BlockVertex.java index c9c465ca7..f65c59627 100644 --- a/src/main/java/com/jozufozu/flywheel/core/vertex/BlockVertex.java +++ b/src/main/java/com/jozufozu/flywheel/core/vertex/BlockVertex.java @@ -71,7 +71,7 @@ Vertex FLWCreateVertex() { ByteBuffer vertexBuffer = renderedBuffer.vertexBuffer(); int vertexCount = drawState.vertexCount(); - if (unshadedStartVertex > 0 && unshadedStartVertex < vertexCount) { + if (unshadedStartVertex >= 0 && unshadedStartVertex < vertexCount) { return createReader(vertexBuffer, vertexCount, unshadedStartVertex); } else { return createReader(vertexBuffer, vertexCount); diff --git a/src/main/java/com/jozufozu/flywheel/mixin/BufferUploaderMixin.java b/src/main/java/com/jozufozu/flywheel/mixin/BufferUploaderMixin.java deleted file mode 100644 index 92058feb9..000000000 --- a/src/main/java/com/jozufozu/flywheel/mixin/BufferUploaderMixin.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.jozufozu.flywheel.mixin; - -import javax.annotation.Nullable; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -import com.jozufozu.flywheel.backend.gl.GlStateTracker; -import com.mojang.blaze3d.vertex.BufferUploader; -import com.mojang.blaze3d.vertex.VertexBuffer; -import com.mojang.blaze3d.vertex.VertexFormat; - -@Mixin(BufferUploader.class) -public class BufferUploaderMixin { - - @Shadow - @Nullable - private static VertexBuffer lastImmediateBuffer; - - @Inject(method = "reset", at = @At("HEAD")) - private static void stopBufferUploaderFromClearingBufferStateIfNothingIsBound(CallbackInfo ci) { - // Trust our tracker over BufferUploader's. - if (GlStateTracker.getVertexArray() == 0) { - lastImmediateBuffer = null; - } - } -} diff --git a/src/main/java/com/jozufozu/flywheel/mixin/LevelRendererMixin.java b/src/main/java/com/jozufozu/flywheel/mixin/LevelRendererMixin.java index 497a81ee5..2d545d55b 100644 --- a/src/main/java/com/jozufozu/flywheel/mixin/LevelRendererMixin.java +++ b/src/main/java/com/jozufozu/flywheel/mixin/LevelRendererMixin.java @@ -16,7 +16,6 @@ import com.jozufozu.flywheel.core.crumbling.CrumblingRenderer; import com.jozufozu.flywheel.event.BeginFrameEvent; import com.jozufozu.flywheel.event.ReloadRenderersEvent; import com.jozufozu.flywheel.event.RenderLayerEvent; -import com.mojang.blaze3d.vertex.BufferUploader; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Matrix4f; @@ -58,7 +57,7 @@ public class LevelRendererMixin { * This only gets injected if renderChunkLayer is not Overwritten */ @Group(name = "flywheel$renderLayer", min = 1, max = 2) - @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/ShaderInstance;clear()V"), method = "renderChunkLayer") + @Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiling/ProfilerFiller;pop()V", ordinal = 1), method = "renderChunkLayer") private void renderLayer(RenderType type, PoseStack stack, double camX, double camY, double camZ, Matrix4f p_172999_, CallbackInfo ci) { flywheel$renderLayer(type, stack, camX, camY, camZ); flywheel$LayerRendered = true; @@ -74,7 +73,6 @@ public class LevelRendererMixin { flywheel$renderLayer(type, stack, camX, camY, camZ); } flywheel$LayerRendered = false; - BufferUploader.reset(); } @Unique diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index 9eedd54e7..7853aae43 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -1,5 +1,5 @@ modLoader = "javafml" -loaderVersion = "[41,)" +loaderVersion = "[43,)" issueTrackerURL = "https://github.com/Jozufozu/Flywheel/issues" license = "MIT" @@ -18,13 +18,13 @@ A modern engine for modded minecraft.''' [[dependencies.flywheel]] modId = "forge" mandatory = true -versionRange = "[41.0.0,)" +versionRange = "[43.0.0,)" ordering = "NONE" side = "CLIENT" [[dependencies.flywheel]] modId = "minecraft" mandatory = true -versionRange = "[1.19,1.20)" +versionRange = "[1.19.2,1.20)" ordering = "NONE" side = "CLIENT" diff --git a/src/main/resources/flywheel.mixins.json b/src/main/resources/flywheel.mixins.json index 284039b65..265b160c7 100644 --- a/src/main/resources/flywheel.mixins.json +++ b/src/main/resources/flywheel.mixins.json @@ -8,7 +8,6 @@ "BlockEntityRenderDispatcherAccessor", "BlockEntityTypeMixin", "BufferBuilderMixin", - "BufferUploaderMixin", "CameraMixin", "instancemanage.ChunkRebuildHooksMixin", "instancemanage.ChunkRenderDispatcherAccessor",