diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index 57148b3..18995d5 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -38,3 +38,21 @@ jobs: name: ${{github.ref_name}}-1.20.6 - Fabric files: 'versions/1.20.6-fabric/build/libs/!(*-@(dev|sources|javadoc|all)).jar' game-versions: 1.20.6 + - name: Publish-1.21-fabric-Curseforge + uses: Kir-Antipov/mc-publish@v3.3.0 + with: + curseforge-id: 681953 + curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }} + loaders: fabric + name: ${{github.ref_name}}-1.21 - Fabric + files: 'versions/1.21-fabric/build/libs/!(*-@(dev|sources|javadoc|all)).jar' + game-versions: 1.21 + - name: Publish-1.21-fabric-Modrinth + uses: Kir-Antipov/mc-publish@v3.3.0 + with: + modrinth-id: DynYZEae + modrinth-token: ${{ secrets.MODRINTH_TOKEN }} + loaders: fabric + name: ${{github.ref_name}}-1.21 - Fabric + files: 'versions/1.21-fabric/build/libs/!(*-@(dev|sources|javadoc|all)).jar' + game-versions: 1.21 diff --git a/gradle-compose.yml b/gradle-compose.yml index 0953547..e372a1d 100644 --- a/gradle-compose.yml +++ b/gradle-compose.yml @@ -1,5 +1,5 @@ version: '0.0.2' -source: "https://github.com/tr7zw/ProcessedModTemplate/tree/legacy12006" +source: "https://github.com/tr7zw/ProcessedModTemplate/tree/master" replacements: name: "Exordium" id: "exordium" diff --git a/settings.json b/settings.json index 4438e35..4a59c8d 100644 --- a/settings.json +++ b/settings.json @@ -1,5 +1,6 @@ { "versions": [ - "1.20.6-fabric" + "1.20.6-fabric", + "1.21-fabric" ] } diff --git a/src/main/java/dev/tr7zw/exordium/ExordiumMod.java b/src/main/java/dev/tr7zw/exordium/ExordiumMod.java index 3f94352..202acad 100644 --- a/src/main/java/dev/tr7zw/exordium/ExordiumMod.java +++ b/src/main/java/dev/tr7zw/exordium/ExordiumMod.java @@ -3,6 +3,7 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; +import dev.tr7zw.util.NMSHelper; import dev.tr7zw.exordium.util.ReloadTracker; import net.fabricmc.api.ClientModInitializer; import net.fabricmc.fabric.api.resource.ResourceManagerHelper; @@ -22,7 +23,7 @@ public void onInitializeClient() { .registerReloadListener(new SimpleResourceReloadListener<>() { @Override public ResourceLocation getFabricId() { - return new ResourceLocation("exordium", "reload_listener"); + return NMSHelper.getResourceLocation("exordium", "reload_listener"); } @Override diff --git a/src/main/java/dev/tr7zw/exordium/mixin/CrosshairMixin.java b/src/main/java/dev/tr7zw/exordium/mixin/CrosshairMixin.java index 34e83eb..97a3091 100644 --- a/src/main/java/dev/tr7zw/exordium/mixin/CrosshairMixin.java +++ b/src/main/java/dev/tr7zw/exordium/mixin/CrosshairMixin.java @@ -13,6 +13,12 @@ import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.DebugScreenOverlay; +//spotless:off +//#if MC >= 12100 +import net.minecraft.client.DeltaTracker; +//#endif +//spotless:on + @Mixin(Gui.class) public class CrosshairMixin { @@ -20,7 +26,13 @@ public class CrosshairMixin { private DebugScreenOverlay debugOverlay; @Inject(method = "renderCrosshair", at = @At("HEAD"), cancellable = true) - private void renderCrosshairStart(GuiGraphics guiGraphics, float f, CallbackInfo ci) { + //spotless:off + //#if MC >= 12100 + private void renderCrosshairStart(GuiGraphics guiGraphics, DeltaTracker delta, CallbackInfo ci) { + //#else + //$$ private void renderCrosshairStart(GuiGraphics guiGraphics, float f, CallbackInfo ci) { + //#endif + //spotless:on BufferInstance buffer = ExordiumModBase.instance.getBufferManager() .getBufferInstance(CrosshairComponent.getId(), DebugScreenOverlay.class); if (buffer.renderBuffer(0, debugOverlay)) { @@ -30,7 +42,13 @@ private void renderCrosshairStart(GuiGraphics guiGraphics, float f, CallbackInfo } @Inject(method = "renderCrosshair", at = @At("TAIL")) - private void renderCrosshairEnd(GuiGraphics guiGraphics, float f, CallbackInfo ci) { + //spotless:off + //#if MC >= 12100 + private void renderCrosshairEnd(GuiGraphics guiGraphics, DeltaTracker delta, CallbackInfo ci) { + //#else + //$$ private void renderCrosshairEnd(GuiGraphics guiGraphics, float f, CallbackInfo ci) { + //#endif + //spotless:on BufferInstance buffer = ExordiumModBase.instance.getBufferManager() .getBufferInstance(CrosshairComponent.getId(), DebugScreenOverlay.class); buffer.postRender(debugOverlay); diff --git a/src/main/java/dev/tr7zw/exordium/mixin/GameRendererMixin.java b/src/main/java/dev/tr7zw/exordium/mixin/GameRendererMixin.java index 9022ad3..5c0092f 100644 --- a/src/main/java/dev/tr7zw/exordium/mixin/GameRendererMixin.java +++ b/src/main/java/dev/tr7zw/exordium/mixin/GameRendererMixin.java @@ -20,10 +20,10 @@ @Mixin(value = GameRenderer.class, priority = 500) // needs to be lower to cancel Architectury for REI public abstract class GameRendererMixin { - @Redirect(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GameRenderer;resetProjectionMatrix(Lorg/joml/Matrix4f;)V")) - public void renderLevel(GameRenderer gr, Matrix4f matrix4f, float f, long l) { - resetProjectionMatrix(matrix4f); - } +// @Redirect(method = "renderLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GameRenderer;resetProjectionMatrix(Lorg/joml/Matrix4f;)V")) +// public void renderLevel(GameRenderer gr, Matrix4f matrix4f, float f, long l) { +// resetProjectionMatrix(matrix4f); +// } @Shadow public abstract void resetProjectionMatrix(Matrix4f matrix4f); diff --git a/src/main/java/dev/tr7zw/exordium/mixin/GuiHotbarMixin.java b/src/main/java/dev/tr7zw/exordium/mixin/GuiHotbarMixin.java index 3412b26..eb1bcc5 100644 --- a/src/main/java/dev/tr7zw/exordium/mixin/GuiHotbarMixin.java +++ b/src/main/java/dev/tr7zw/exordium/mixin/GuiHotbarMixin.java @@ -11,14 +11,27 @@ import dev.tr7zw.exordium.components.vanilla.HotbarComponent; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.gui.components.spectator.SpectatorGui; + +//spotless:off +//#if MC >= 12100 +import net.minecraft.client.DeltaTracker; +//#endif +//spotless:on @Mixin(Gui.class) public class GuiHotbarMixin { + //spotless:off + //#if MC >= 12100 @WrapOperation(method = "renderHotbarAndDecorations", at = { - @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Gui;renderItemHotbar(Lnet/minecraft/client/gui/GuiGraphics;F)V"), }) - private void renderHotbarWrapper(Gui gui, GuiGraphics guiGraphics, float f, final Operation operation) { + @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Gui;renderItemHotbar(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/client/DeltaTracker;)V")}) + private void renderHotbarWrapper(Gui gui, GuiGraphics guiGraphics, DeltaTracker f, final Operation operation) { + //#else + //$$ @WrapOperation(method = "renderHotbarAndDecorations", at = { + //$$ @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/Gui;renderItemHotbar(Lnet/minecraft/client/gui/GuiGraphics;F)V")}) + //$$ private void renderHotbarWrapper(Gui gui, GuiGraphics guiGraphics, float f, final Operation operation) { + //#endif + //spotless:on BufferInstance buffer = ExordiumModBase.instance.getBufferManager() .getBufferInstance(HotbarComponent.getId(), Void.class); if (!buffer.renderBuffer(0, null)) { diff --git a/src/main/java/dev/tr7zw/exordium/mixin/GuiMixin.java b/src/main/java/dev/tr7zw/exordium/mixin/GuiMixin.java index 8af9af1..0010ca6 100644 --- a/src/main/java/dev/tr7zw/exordium/mixin/GuiMixin.java +++ b/src/main/java/dev/tr7zw/exordium/mixin/GuiMixin.java @@ -26,6 +26,12 @@ import net.minecraft.world.scores.Objective; import net.minecraft.world.scores.Scoreboard; +//spotless:off +//#if MC >= 12100 +import net.minecraft.client.DeltaTracker; +//#endif +//spotless:on + @Mixin(Gui.class) public abstract class GuiMixin implements GuiAccess { @@ -79,7 +85,13 @@ private void renderBossBarWrapper(BossHealthOverlay instance, GuiGraphics guiGra } @Inject(method = "render", at = @At(value = "TAIL")) - public void render(GuiGraphics guiGraphics, float partialTick, CallbackInfo ci) { + //spotless:off + //#if MC >= 12100 + public void render(GuiGraphics guiGraphics, DeltaTracker partialTick, CallbackInfo ci) { + //#else + //$$ public void render(GuiGraphics guiGraphics, float partialTick, CallbackInfo ci) { + //#endif + //spotless:on ExordiumModBase.instance.getDelayedRenderCallManager().renderComponents(); } diff --git a/src/main/java/dev/tr7zw/exordium/mixin/VignetteMixin.java b/src/main/java/dev/tr7zw/exordium/mixin/VignetteMixin.java index e975ff2..50be46b 100644 --- a/src/main/java/dev/tr7zw/exordium/mixin/VignetteMixin.java +++ b/src/main/java/dev/tr7zw/exordium/mixin/VignetteMixin.java @@ -12,6 +12,7 @@ import dev.tr7zw.exordium.ExordiumModBase; import dev.tr7zw.exordium.components.BufferInstance; import dev.tr7zw.exordium.components.vanilla.VignetteComponent; +import dev.tr7zw.util.NMSHelper; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.GuiGraphics; @@ -27,9 +28,9 @@ public class VignetteMixin { @Final private Minecraft minecraft; - private static ResourceLocation FAST_VIGNETTE_LOCATION = new ResourceLocation("exordium", + private static ResourceLocation FAST_VIGNETTE_LOCATION = NMSHelper.getResourceLocation("exordium", "textures/misc/fast_vignette.png"); - private static ResourceLocation FAST_VIGNETTE_DARK_LOCATION = new ResourceLocation("exordium", + private static ResourceLocation FAST_VIGNETTE_DARK_LOCATION = NMSHelper.getResourceLocation("exordium", "textures/misc/fast_vignette_dark.png"); @WrapOperation(method = "renderCameraOverlays", at = { diff --git a/src/main/java/dev/tr7zw/exordium/render/Model.java b/src/main/java/dev/tr7zw/exordium/render/Model.java index 5a96b26..1b5e24a 100644 --- a/src/main/java/dev/tr7zw/exordium/render/Model.java +++ b/src/main/java/dev/tr7zw/exordium/render/Model.java @@ -6,26 +6,52 @@ import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.BufferBuilder; import com.mojang.blaze3d.vertex.DefaultVertexFormat; +import com.mojang.blaze3d.vertex.Tesselator; import com.mojang.blaze3d.vertex.VertexBuffer; -import com.mojang.blaze3d.vertex.VertexFormat; +import com.mojang.blaze3d.vertex.VertexFormat.Mode; import net.minecraft.client.renderer.ShaderInstance; +//spotless:off +//#if MC >= 12100 +import com.mojang.blaze3d.vertex.MeshData; +//#else +//$$ import com.mojang.blaze3d.vertex.VertexFormat; +//#endif +//spotless:on + public class Model { private VertexBuffer toDraw; public Model(Vector3f[] modelData, Vector2f[] uvData) { // 4 bytes per float, 5 floats per entry - BufferBuilder bufferbuilder = new BufferBuilder(modelData.length * 4 * 5); - - bufferbuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); + // spotless:off + //#if MC >= 12100 + BufferBuilder bufferbuilder = Tesselator.getInstance().begin(Mode.QUADS, DefaultVertexFormat.POSITION_TEX); //new BufferBuilder(modelData.length * 4 * 5); + //#else + //$$ BufferBuilder bufferbuilder = new BufferBuilder(modelData.length * 4 * 5); + //$$ bufferbuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); + //#endif + //spotless:on for (int i = 0; i < modelData.length; i++) { Vector3f pos = modelData[i]; Vector2f uv = uvData[i]; - bufferbuilder.vertex(pos.x(), pos.y(), pos.z()).uv(uv.x(), uv.y()).endVertex(); + // spotless:off + //#if MC >= 12100 + bufferbuilder.addVertex(pos.x(), pos.y(), pos.z()).setUv(uv.x(), uv.y()); + //#else + //$$ bufferbuilder.vertex(pos.x(), pos.y(), pos.z()).uv(uv.x(), uv.y()).endVertex(); + //#endif + //spotless:on } toDraw = new VertexBuffer(VertexBuffer.Usage.STATIC); - upload(bufferbuilder.end()); + // spotless:off + //#if MC >= 12100 + upload(bufferbuilder.build()); + //#else + //$$ upload(bufferbuilder.end()); + //#endif + //spotless:on } public void drawWithShader(Matrix4f matrix4f, Matrix4f matrix4f2, ShaderInstance shaderInstance) { @@ -37,14 +63,16 @@ public void draw(Matrix4f matrix4f) { drawWithShader(matrix4f, RenderSystem.getProjectionMatrix(), RenderSystem.getShader()); } - private void upload(BufferBuilder.RenderedBuffer renderedBuffer) { + // spotless:off + //#if MC >= 12100 + private void upload(MeshData renderedBuffer) { + //#else + //$$ private void upload(BufferBuilder.RenderedBuffer renderedBuffer) { + //#endif + //spotless:on RenderSystem.assertOnRenderThread(); - if (renderedBuffer.isEmpty()) { - renderedBuffer.release(); - } else { - toDraw.bind(); - toDraw.upload(renderedBuffer); - } + toDraw.bind(); + toDraw.upload(renderedBuffer); } public void close() { diff --git a/versions/mainProject b/versions/mainProject index 304eaac..dfdd511 100644 --- a/versions/mainProject +++ b/versions/mainProject @@ -1 +1 @@ -1.20.6-fabric \ No newline at end of file +1.21-fabric \ No newline at end of file