Skip to content

Commit

Permalink
clean up, remove redundant mixins and aw
Browse files Browse the repository at this point in the history
  • Loading branch information
sisby-folk committed Aug 28, 2024
1 parent 2e73701 commit 1849648
Show file tree
Hide file tree
Showing 14 changed files with 54 additions and 117 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
32 changes: 15 additions & 17 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
}

version = "$baseVersion+$branch"
archivesBaseName = project.archivesName
archivesBaseName = project.slug

repositories {
maven { url "https://maven.nucleoid.xyz/" }
Expand All @@ -27,27 +27,22 @@ dependencies {
modLocalRuntime libs.polydex
}

loom {
accessWidenerPath = file("src/main/resources/glowcase.accesswidener")
}

processResources {
final Map<String, String> 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()
]
Expand All @@ -63,7 +58,8 @@ tasks.withType(JavaCompile).configureEach {

java {
withSourcesJar()
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_21
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

jar {
Expand All @@ -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 = "<!--DO NOT EDIT MANUALLY: synced from gh readme-->\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 = "<!--DO NOT EDIT MANUALLY: synced from gh readme-->\n" + rootProject.file("README.md").text
uploadFile = remapJar
}
10 changes: 6 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 2 additions & 6 deletions libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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" }
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pluginManagement {
repositories {
maven { url 'https://maven.fabricmc.net/' }
maven { url "https://maven.fabricmc.net/" }
gradlePluginPortal()
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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()
Expand All @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand All @@ -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);
}
}
Expand Down Expand Up @@ -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++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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());
}
}

Expand All @@ -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);
Expand Down Expand Up @@ -322,10 +319,5 @@ public static void reset() {
regions.clear();
needsRebuild.clear();
}

public static void setWorld(ClientWorld world) {
reset();
currentWorld = world;
}
}
}

This file was deleted.

This file was deleted.

13 changes: 5 additions & 8 deletions src/main/resources/META-INF/neoforge.mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -28,7 +25,7 @@ side = "BOTH"
[[dependencies.${ modId }]]
modId = "neoforge"
type = "required"
versionRange = "[${neo},)"
versionRange = "*"
ordering = "NONE"
side = "BOTH"

Expand Down
23 changes: 8 additions & 15 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
Expand All @@ -38,7 +26,12 @@
"suggests": {
"polydex": ">=${polydex}"
},
"breaks": {
"polydex": "<${polydex}"
"entrypoints": {
"main": [
"dev.hephaestus.glowcase.Glowcase"
],
"client": [
"dev.hephaestus.glowcase.client.GlowcaseClient"
]
}
}
5 changes: 0 additions & 5 deletions src/main/resources/glowcase.accesswidener

This file was deleted.

13 changes: 0 additions & 13 deletions src/main/resources/glowcase.mixins.json

This file was deleted.

0 comments on commit 1849648

Please sign in to comment.