diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b25623b..5b7df20 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,3 +22,9 @@ jobs: - name: Build with Gradle run: ./gradlew build + + - name: capture build artifacts + uses: actions/upload-artifact@v4 + with: + name: Artifacts + path: build/libs/ diff --git a/build.gradle b/build.gradle index fdda837..c7f534b 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ plugins { } version = "$baseVersion+$branch" -archivesBaseName = project.archivesName +archivesBaseName = project.slug repositories { maven { url "https://maven.nucleoid.xyz/" } @@ -27,27 +27,22 @@ dependencies { modLocalRuntime libs.polydex } -loom { - accessWidenerPath = file("src/main/resources/glowcase.accesswidener") -} - processResources { final Map meta = [ version : version, modId : modId, modName : modName, modDescription: modDescription, - homepage : homepage, - issues : issues, - sources : sources, + homepage : "https://modrinth.com/mod/${slug}", + issues : "https://github.com/${user}/${slug}/issues", + sources : "https://github.com/${user}/${slug}", license : license, authors : authors.split(", ").join("\",\n \""), contributors : contributors.split(", ").join("\",\n \""), members : "${authors}. Contributions by ${contributors}", - mc : libs.versions.mc.get(), + mc : compatibleVersions.split(", ")[0], fl : libs.versions.fl.get(), fapi : libs.versions.fapi.get(), - neo : libs.versions.neo.get(), placeholder : libs.versions.placeholder.get(), polydex : libs.versions.polydex.get() ] @@ -63,7 +58,8 @@ tasks.withType(JavaCompile).configureEach { java { withSourcesJar() - sourceCompatibility = targetCompatibility = JavaVersion.VERSION_21 + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 } jar { @@ -81,15 +77,17 @@ publishing { } modrinth { - token = System.getenv("MODRINTH_TOKEN") - projectId = "glowcase" - loaders = ["fabric", "neoforge"] // remove once modrinth can detect fabric+neo from jar + token = "$System.env.MODRINTH_TOKEN" + projectId = slug + versionNumber = project.version + uploadFile = remapJar + gameVersions = compatibleVersions.split(", ").toList() + loaders = compatibleLoaders.split(", ").toList() + changelog = "$System.env.CHANGELOG" + syncBodyFrom = "\n" + rootProject.file("README.md").text dependencies { required.version "fabric-api", libs.versions.fapi.get() embedded.version "placeholder-api", libs.versions.placeholder.get() optional.version "polydex", libs.versions.polydex.get() } - changelog = System.getenv("CHANGELOG") - syncBodyFrom = "\n" + rootProject.file("README.md").text - uploadFile = remapJar } diff --git a/gradle.properties b/gradle.properties index 395bce9..dd44ad1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,17 +7,19 @@ org.gradle.configureondemand=true # Loom fabric.loom.multiProjectOptimisation=true # Mod Metadata -archivesName=glowcase group=dev.hephaestus +user=ModFest +slug=glowcase modId=glowcase modName=Glowcase modDescription=Blocks for showcasing mods! authors=HavenKing, ModFest contributors=quaternary, maximumpower55, LemmaEOF, TheEpicBlock, acikek, comp500, Patbox, AmyMialee, Chai, ShiroJR -homepage=https://modrinth.com/mod/glowcase -issues=https://github.com/modfest/glowcase/issues -sources=https://github.com/modfest/glowcase license=CC0-1.0 # Mod Version baseVersion=1.4.0 +# Branch Metadata branch=1.21 +tagBranch=1.21 +compatibleVersions=1.21, 1.21.1 +compatibleLoaders=fabric, quilt, neoforge diff --git a/libs.versions.toml b/libs.versions.toml index 5d516a6..9e7b505 100644 --- a/libs.versions.toml +++ b/libs.versions.toml @@ -3,13 +3,10 @@ loom = "1.7.+" minotaur = "2.+" mc = "1.21" -yarn = "1.21+build.9" - fl = "0.15.11" +yarn = "1.21+build.9" fapi = "0.100.7+1.21" -neo = "21.0.133-beta" - placeholder = "2.4.0+1.21" polydex = "1.2.2+1.21" @@ -19,9 +16,8 @@ minotaur = { id = "com.modrinth.minotaur", version.ref = "minotaur" } [libraries] mc = { group = "mojang", name = "minecraft", version.ref = "mc" } -yarn = { group = "net.fabricmc", name = "yarn", version.ref = "yarn" } - fl = { group = "net.fabricmc", name = "fabric-loader", version.ref = "fl" } +yarn = { group = "net.fabricmc", name = "yarn", version.ref = "yarn" } fapi = { group = "net.fabricmc.fabric-api", name = "fabric-api", version.ref = "fapi" } placeholder = { group = "eu.pb4", name = "placeholder-api", version.ref = "placeholder" } diff --git a/settings.gradle b/settings.gradle index 593ea78..dce0b1d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,6 +1,6 @@ pluginManagement { repositories { - maven { url 'https://maven.fabricmc.net/' } + maven { url "https://maven.fabricmc.net/" } gradlePluginPortal() } } diff --git a/src/main/java/dev/hephaestus/glowcase/client/GlowcaseRenderLayers.java b/src/main/java/dev/hephaestus/glowcase/client/GlowcaseRenderLayers.java index cc1fe73..d5acdf5 100644 --- a/src/main/java/dev/hephaestus/glowcase/client/GlowcaseRenderLayers.java +++ b/src/main/java/dev/hephaestus/glowcase/client/GlowcaseRenderLayers.java @@ -1,11 +1,10 @@ package dev.hephaestus.glowcase.client; import net.minecraft.client.render.RenderLayer; -import net.minecraft.client.render.RenderPhase; import net.minecraft.client.render.VertexFormat; import net.minecraft.client.render.VertexFormats; -public class GlowcaseRenderLayers extends RenderPhase { +public abstract class GlowcaseRenderLayers extends RenderLayer { // Use a custom render layer to render the text plate - mimics DrawableHelper's RenderSystem call public static final RenderLayer TEXT_PLATE = RenderLayer.of("glowcase_text_plate", VertexFormats.POSITION_COLOR, VertexFormat.DrawMode.QUADS, 256, true, true, RenderLayer.MultiPhaseParameters.builder() @@ -15,7 +14,7 @@ public class GlowcaseRenderLayers extends RenderPhase { .program(COLOR_PROGRAM) .build(false)); - private GlowcaseRenderLayers() { - super(null, null, null); + public GlowcaseRenderLayers(String name, VertexFormat vertexFormat, VertexFormat.DrawMode drawMode, int expectedBufferSize, boolean hasCrumbling, boolean translucent, Runnable startAction, Runnable endAction) { + super(name, vertexFormat, drawMode, expectedBufferSize, hasCrumbling, translucent, startAction, endAction); } } diff --git a/src/main/java/dev/hephaestus/glowcase/client/gui/screen/ingame/TextBlockEditScreen.java b/src/main/java/dev/hephaestus/glowcase/client/gui/screen/ingame/TextBlockEditScreen.java index c21852d..ae97861 100644 --- a/src/main/java/dev/hephaestus/glowcase/client/gui/screen/ingame/TextBlockEditScreen.java +++ b/src/main/java/dev/hephaestus/glowcase/client/gui/screen/ingame/TextBlockEditScreen.java @@ -226,19 +226,19 @@ public boolean keyPressed(int keyCode, int scanCode, int modifiers) { )); this.textBlockEntity.renderDirty = true; ++this.currentRow; - this.selectionManager.moveCursorToStart(false); + this.selectionManager.moveCursorToStart(); return true; } else if (keyCode == GLFW.GLFW_KEY_UP) { this.currentRow = Math.max(this.currentRow - 1, 0); - this.selectionManager.moveCursorToEnd(false); + this.selectionManager.putCursorAtEnd(); return true; } else if (keyCode == GLFW.GLFW_KEY_DOWN) { this.currentRow = Math.min(this.currentRow + 1, (this.textBlockEntity.lines.size() - 1)); - this.selectionManager.moveCursorToEnd(false); + this.selectionManager.putCursorAtEnd(); return true; } else if (keyCode == GLFW.GLFW_KEY_BACKSPACE && this.currentRow > 0 && this.textBlockEntity.lines.size() > 1 && this.selectionManager.getSelectionStart() == 0 && this.selectionManager.getSelectionEnd() == this.selectionManager.getSelectionStart()) { --this.currentRow; - this.selectionManager.moveCursorToEnd(false); + this.selectionManager.putCursorAtEnd(); deleteLine(); return true; } else if (keyCode == GLFW.GLFW_KEY_DELETE && this.currentRow < this.textBlockEntity.lines.size() - 1 && this.selectionManager.getSelectionEnd() == this.textBlockEntity.getRawLine(this.currentRow).length()) { @@ -263,7 +263,7 @@ public boolean keyPressed(int keyCode, int scanCode, int modifiers) { )); this.textBlockEntity.renderDirty = true; ++this.currentRow; - this.selectionManager.moveCursorToEnd(false); + this.selectionManager.putCursorAtEnd(); this.selectionManager.moveCursor(-selectionOffset); } } @@ -322,7 +322,7 @@ public boolean mouseClicked(double mouseX, double mouseY, int button) { if (mouseX <= contentsStart) { this.selectionManager.moveCursorToStart(); } else if (mouseX >= contentsEnd) { - this.selectionManager.moveCursorToEnd(false); + this.selectionManager.putCursorAtEnd(); } else { int lastWidth = 0; for (int i = 1; i < baseContents.length(); i++) { diff --git a/src/main/java/dev/hephaestus/glowcase/client/render/block/entity/BakedBlockEntityRenderer.java b/src/main/java/dev/hephaestus/glowcase/client/render/block/entity/BakedBlockEntityRenderer.java index d40ac53..56cca49 100644 --- a/src/main/java/dev/hephaestus/glowcase/client/render/block/entity/BakedBlockEntityRenderer.java +++ b/src/main/java/dev/hephaestus/glowcase/client/render/block/entity/BakedBlockEntityRenderer.java @@ -23,7 +23,6 @@ import net.minecraft.client.render.block.entity.BlockEntityRendererFactory; import net.minecraft.client.util.BufferAllocator; import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.client.world.ClientWorld; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import org.jetbrains.annotations.NotNull; @@ -137,8 +136,6 @@ public void reset() { private static final CachedVertexConsumerProvider vcp = new CachedVertexConsumerProvider(); - private static ClientWorld currentWorld = null; - private static final Logger LOGGER = LogUtils.getLogger(); private static VertexBuffer getVertexBuffer() { @@ -218,7 +215,7 @@ public static void render(WorldRenderContext wrc) { // Find all block entities in this region for (int chunkX = rrp.x << REGION_FROMCHUNK_SHIFT; chunkX < (rrp.x + 1) << REGION_FROMCHUNK_SHIFT; chunkX++) { for (int chunkZ = rrp.z << REGION_FROMCHUNK_SHIFT; chunkZ < (rrp.z + 1) << REGION_FROMCHUNK_SHIFT; chunkZ++) { - blockEntities.addAll(currentWorld.getChunk(chunkX, chunkZ).getBlockEntities().values()); + blockEntities.addAll(wrc.world().getChunk(chunkX, chunkZ).getBlockEntities().values()); } } @@ -231,7 +228,7 @@ public static void render(WorldRenderContext wrc) { bakeMatrices.push(); bakeMatrices.translate(pos.getX() & MAX_XZ_IN_REGION, pos.getY(), pos.getZ() & MAX_XZ_IN_REGION); try { - renderer.renderBaked(be, bakeMatrices, vcp, WorldRenderer.getLightmapCoordinates(currentWorld, pos), OverlayTexture.DEFAULT_UV); + renderer.renderBaked(be, bakeMatrices, vcp, WorldRenderer.getLightmapCoordinates(wrc.world(), pos), OverlayTexture.DEFAULT_UV); bakedAnything = true; } catch (Throwable t) { LOGGER.error("Block entity renderer threw exception during baking : ", t); @@ -322,10 +319,5 @@ public static void reset() { regions.clear(); needsRebuild.clear(); } - - public static void setWorld(ClientWorld world) { - reset(); - currentWorld = world; - } } } diff --git a/src/main/java/dev/hephaestus/glowcase/mixin/client/MinecraftClientAccessor.java b/src/main/java/dev/hephaestus/glowcase/mixin/client/MinecraftClientAccessor.java deleted file mode 100644 index bbcd07f..0000000 --- a/src/main/java/dev/hephaestus/glowcase/mixin/client/MinecraftClientAccessor.java +++ /dev/null @@ -1,11 +0,0 @@ -package dev.hephaestus.glowcase.mixin.client; - -import net.minecraft.client.MinecraftClient; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Invoker; - -@Mixin(MinecraftClient.class) -public interface MinecraftClientAccessor { - @Invoker - void invokeOpenChatScreen(String text); -} diff --git a/src/main/java/dev/hephaestus/glowcase/mixin/client/render/ber/WorldRendererMixin.java b/src/main/java/dev/hephaestus/glowcase/mixin/client/render/ber/WorldRendererMixin.java deleted file mode 100644 index 7d86a43..0000000 --- a/src/main/java/dev/hephaestus/glowcase/mixin/client/render/ber/WorldRendererMixin.java +++ /dev/null @@ -1,17 +0,0 @@ -package dev.hephaestus.glowcase.mixin.client.render.ber; - -import dev.hephaestus.glowcase.client.render.block.entity.BakedBlockEntityRenderer; -import net.minecraft.client.render.WorldRenderer; -import net.minecraft.client.world.ClientWorld; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(WorldRenderer.class) -public class WorldRendererMixin { - @Inject(method = "setWorld", at = @At("HEAD")) - public void onSetWorld(ClientWorld clientWorld, CallbackInfo ci) { - BakedBlockEntityRenderer.Manager.setWorld(clientWorld); - } -} \ No newline at end of file diff --git a/src/main/resources/META-INF/neoforge.mods.toml b/src/main/resources/META-INF/neoforge.mods.toml index 2a53008..29344ad 100644 --- a/src/main/resources/META-INF/neoforge.mods.toml +++ b/src/main/resources/META-INF/neoforge.mods.toml @@ -7,16 +7,13 @@ issueTrackerURL = "${issues}" modId = "${modId}" version = "${version}" displayName = "${modName}" -displayURL = "${homepage}" -logoFile = "assets/glowcase/icon.png" -authors = "${members}" description = '''${modDescription}''' - -[[mixins]] -config = "glowcase.mixins.json" +authors = "${members}" +displayURL = "${homepage}" +logoFile = "assets/${modId}/icon.png" [properties] -"connector:placeholder"=true +"connector:placeholder" = true [[dependencies.${ modId }]] modId = "connector" @@ -28,7 +25,7 @@ side = "BOTH" [[dependencies.${ modId }]] modId = "neoforge" type = "required" -versionRange = "[${neo},)" +versionRange = "*" ordering = "NONE" side = "BOTH" diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index eae9b2d..6aa5b52 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -15,20 +15,8 @@ "issues": "${issues}", "sources": "${sources}" }, - "icon": "assets/glowcase/icon.png", "license": "${license}", - "entrypoints": { - "main": [ - "dev.hephaestus.glowcase.Glowcase" - ], - "client": [ - "dev.hephaestus.glowcase.client.GlowcaseClient" - ] - }, - "mixins": [ - "glowcase.mixins.json" - ], - "accessWidener": "glowcase.accesswidener", + "icon": "assets/${modId}/icon.png", "depends": { "minecraft": ">=${mc}", "fabricloader": ">=${fl}", @@ -38,7 +26,12 @@ "suggests": { "polydex": ">=${polydex}" }, - "breaks": { - "polydex": "<${polydex}" + "entrypoints": { + "main": [ + "dev.hephaestus.glowcase.Glowcase" + ], + "client": [ + "dev.hephaestus.glowcase.client.GlowcaseClient" + ] } } diff --git a/src/main/resources/glowcase.accesswidener b/src/main/resources/glowcase.accesswidener deleted file mode 100644 index da4787d..0000000 --- a/src/main/resources/glowcase.accesswidener +++ /dev/null @@ -1,5 +0,0 @@ -accessWidener v1 named -accessible method net/minecraft/client/util/SelectionManager moveCursorToEnd (Z)V - -accessible method net/minecraft/client/render/RenderLayer of (Ljava/lang/String;Lnet/minecraft/client/render/VertexFormat;Lnet/minecraft/client/render/VertexFormat$DrawMode;IZZLnet/minecraft/client/render/RenderLayer$MultiPhaseParameters;)Lnet/minecraft/client/render/RenderLayer$MultiPhase; -accessible class net/minecraft/client/render/RenderLayer$MultiPhaseParameters diff --git a/src/main/resources/glowcase.mixins.json b/src/main/resources/glowcase.mixins.json deleted file mode 100644 index c5152b3..0000000 --- a/src/main/resources/glowcase.mixins.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "required": true, - "package": "dev.hephaestus.glowcase.mixin", - "compatibilityLevel": "JAVA_8", - "mixins": [], - "client": [ - "client.MinecraftClientAccessor", - "client.render.ber.WorldRendererMixin" - ], - "injectors": { - "defaultRequire": 1 - } -}