Skip to content

Commit

Permalink
Initial port to 1.21 (builds, untested)
Browse files Browse the repository at this point in the history
  • Loading branch information
comp500 committed Jun 10, 2024
1 parent 56c7930 commit 0b281e5
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 30 deletions.
14 changes: 7 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.1.+'
id 'fabric-loom' version '1.6.+'
id 'maven-publish'

id "com.github.breadmoirai.github-release" version "2.4.1"
Expand All @@ -8,8 +8,8 @@ plugins {
id "com.matthewprenger.cursegradle" version "1.4.0"
}

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21

String getGitVersion(Project project) {
if (grgit != null) {
Expand Down Expand Up @@ -80,8 +80,8 @@ tasks.withType(JavaCompile).configureEach {
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"

// Minecraft 1.18 upwards uses Java 17.
it.options.release = 17
// Minecraft 1.20.5 upwards uses Java 21.
it.options.release = 21
}

java {
Expand Down Expand Up @@ -111,8 +111,8 @@ publishing {
}

// TODO: infer from fabric.mod.json?!
def supportedVersions = ["1.20.1", "1.20.3", "${project.minecraft_version}", "1.20.5", "1.20.6"]
def verName = "Indium ${project.mod_version} for Minecraft 1.20.x/Sodium ${project.sodium_version}"
def supportedVersions = ["${project.minecraft_version}"]
def verName = "Indium ${project.mod_version} for Minecraft 1.21.x/Sodium ${project.sodium_version}"

// Check version is as expected
if (System.getenv("EXPECTED_VERSION") !== null) {
Expand Down
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.3
loader_version=0.15.3
minecraft_version=1.21-rc1
yarn_mappings=1.21-rc1+build.1
loader_version=0.15.11
# Mod Properties
mod_version=1.0.31
mod_version=1.0.30
maven_group=link.infra
archives_base_name=indium
# Dependencies
# check this on https://modmuss50.me/fabric.html
fabric_version=0.91.3+1.20.4
fabric_version=0.100.0+1.21
sodium_version=0.5.8
sodium_minecraft_version=1.20.4
sodium_minecraft_version=1.20.5
# Publishing metadata
curseforge_id=459496
source_url=https://github.com/comp500/Indium/
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
8 changes: 4 additions & 4 deletions src/main/java/link/infra/indium/other/SpriteFinderCache.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package link.infra.indium.other;

import java.util.Collection;
import java.util.List;

import net.fabricmc.fabric.api.renderer.v1.model.SpriteFinder;
import net.fabricmc.fabric.api.resource.ResourceReloadListenerKeys;
import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener;
Expand All @@ -12,6 +9,9 @@
import net.minecraft.screen.PlayerScreenHandler;
import net.minecraft.util.Identifier;

import java.util.Collection;
import java.util.List;

/**
* Cache SpriteFinders for maximum efficiency.
*
Expand All @@ -25,7 +25,7 @@ public static SpriteFinder forBlockAtlas() {
}

public static class ReloadListener implements SimpleSynchronousResourceReloadListener {
public static final Identifier ID = new Identifier("indium", "sprite_finder_cache");
public static final Identifier ID = Identifier.of("indium", "sprite_finder_cache");
public static final List<Identifier> DEPENDENCIES = List.of(ResourceReloadListenerKeys.MODELS);
public static final ReloadListener INSTANCE = new ReloadListener();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package link.infra.indium.renderer.mesh;

import com.google.common.base.Preconditions;

import link.infra.indium.renderer.helper.GeometryHelper;
import link.infra.indium.renderer.material.RenderMaterialImpl;
import me.jellysquid.mods.sodium.client.model.quad.properties.ModelQuadFacing;
Expand Down Expand Up @@ -66,7 +65,7 @@ private EncodingFormat() { }
VERTEX_V = VERTEX_U + 1;
VERTEX_LIGHTMAP = HEADER_STRIDE + 6;
VERTEX_NORMAL = HEADER_STRIDE + 7;
VERTEX_STRIDE = format.getVertexSizeInteger();
VERTEX_STRIDE = format.getVertexSizeByte();
QUAD_STRIDE = VERTEX_STRIDE * 4;
QUAD_STRIDE_BYTES = QUAD_STRIDE * 4;
TOTAL_STRIDE = HEADER_STRIDE + QUAD_STRIDE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,6 @@

package link.infra.indium.renderer.render;

import java.util.function.Consumer;

import org.joml.Matrix3f;
import org.joml.Matrix4f;
import org.joml.Vector3f;
import org.joml.Vector4f;

import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import link.infra.indium.other.SpriteFinderCache;
import link.infra.indium.renderer.mesh.MutableQuadViewImpl;
Expand All @@ -32,6 +25,12 @@
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
import net.minecraft.client.render.VertexConsumer;
import net.minecraft.client.texture.Sprite;
import org.joml.Matrix3f;
import org.joml.Matrix4f;
import org.joml.Vector3f;
import org.joml.Vector4f;

import java.util.function.Consumer;

abstract class AbstractRenderContext implements RenderContext {
private static final QuadTransform NO_TRANSFORM = q -> true;
Expand Down Expand Up @@ -131,7 +130,6 @@ protected void bufferQuad(MutableQuadViewImpl quad, VertexConsumer vertexConsume
}

vertexConsumer.normal(normalVec.x(), normalVec.y(), normalVec.z());
vertexConsumer.next();
}

Sprite sprite = quad.cachedSprite();
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
],
"depends": {
"fabricloader": ">=0.8.0",
"minecraft": "~1.20.1",
"minecraft": "~1.21.0",
"sodium": "0.5.8",
"fabric-renderer-api-v1": ">=3.2.0",
"fabric-resource-loader-v0": ">=0.4.0"
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/indium.mixins.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"required": true,
"package": "link.infra.indium.mixin",
"compatibilityLevel": "JAVA_17",
"compatibilityLevel": "JAVA_21",
"client": [
"renderer.AccessAmbientOcclusionCalculator",
"renderer.MixinBlockModelRenderer",
Expand Down

0 comments on commit 0b281e5

Please sign in to comment.