Skip to content

Commit

Permalink
Merge branch '1.21/dev' into 1.21/stable
Browse files Browse the repository at this point in the history
  • Loading branch information
FlashyReese committed Sep 15, 2024
2 parents 0ebbb55 + 94efc1c commit cdaa048
Show file tree
Hide file tree
Showing 15 changed files with 72 additions and 252 deletions.
60 changes: 31 additions & 29 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,31 +25,33 @@ jobs:
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
${{ github.workspace }}/neoforge/build/libs/!(*-@(dev|sources|javadoc|dev-shadow)).jar
${{ github.workspace }}/neoforge/build/libs/*-@(dev|sources|javadoc|dev-shadow).jar
${{ github.workspace }}/fabric/build/libs/!(*-@(dev|sources|javadoc|dev-shadow)).jar
${{ github.workspace }}/fabric/build/libs/*-@(dev|sources|javadoc|dev-shadow).jar
publish:
needs: build
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- platform: fabric
name: Fabric
- platform: neoforge
name: NeoForge
steps:
- name: Download Build Artifacts
uses: actions/download-artifact@v3
- name: Publish Fabric to Modrinth, CurseForge & GitHub
uses: Kir-Antipov/[email protected]
with:
name: build-artifacts
- name: Publish ${{ matrix.name }} to Modrinth, CurseForge & GitHub
modrinth-id: PtjYWJkn
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}

curseforge-id: 447673
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}

github-token: ${{ secrets.GITHUB_TOKEN }}

name: '[Fabric] ${{ github.event.release.name }}'
version: '${{ github.event.release.tag_name }}+fabric'
version-type: release

loaders: fabric

dependencies: |
sodium
reeses-sodium-options(optional)
irisshaders(optional)
iris(optional)
files: |
fabric/build/libs/!(*-@(dev|sources|javadoc|dev-shadow)).jar
fabric/build/libs/*-@(dev|sources|javadoc|dev-shadow).jar
- name: Publish NeoForge to Modrinth, CurseForge & GitHub
uses: Kir-Antipov/[email protected]
with:
modrinth-id: PtjYWJkn
Expand All @@ -60,11 +62,11 @@ jobs:

github-token: ${{ secrets.GITHUB_TOKEN }}

name: '[${{ matrix.name }}] ${{ github.event.release.name }}'
version: '${{ github.event.release.tag_name }}+${{ matrix.platform }}'
name: '[NeoForge] ${{ github.event.release.name }}'
version: '${{ github.event.release.tag_name }}+neoforge'
version-type: release

loaders: ${{ matrix.platform }}
loaders: neoforge

dependencies: |
sodium
Expand All @@ -73,5 +75,5 @@ jobs:
iris(optional)
files: |
${{ github.workspace }}/${{ matrix.platform }}/build/libs/!(*-@(dev|sources|javadoc|dev-shadow)).jar
${{ github.workspace }}/${{ matrix.platform }}/build/libs/*-@(dev|sources|javadoc|dev-shadow).jar
neoforge/build/libs/!(*-@(dev|sources|javadoc|dev-shadow)).jar
neoforge/build/libs/*-@(dev|sources|javadoc|dev-shadow).jar
13 changes: 6 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@ val FABRIC_API_VERSION by extra { "0.102.1+1.21.1" }
val PARCHMENT_VERSION by extra { null }

// https://semver.org/
val MOD_VERSION by extra { "0.6.0-beta.1" }

//
val maven_group: String by project
val archives_name: String by project
val MAVEN_GROUP by extra { "me.flashyreese.mods" }
val ARCHIVE_NAME by extra { "sodium-extra" }
val MOD_VERSION by extra { "0.6.0-beta.2" }
val SODIUM_VERSION by extra { "mc1.21-0.6.0-beta.2" }

allprojects {
apply(plugin = "java")
apply(plugin = "maven-publish")
group = maven_group
group = MAVEN_GROUP
version = createVersionString()
}

Expand All @@ -38,7 +37,7 @@ subprojects {
}

base {
archivesName = "$archives_name-${project.name}"
archivesName = "$ARCHIVE_NAME-${project.name}"
}

java.toolchain.languageVersion = JavaLanguageVersion.of(21)
Expand Down
11 changes: 5 additions & 6 deletions common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ val PARCHMENT_VERSION: String? by rootProject.extra
val FABRIC_LOADER_VERSION: String by rootProject.extra
val FABRIC_API_VERSION: String by rootProject.extra

val SODIUM_VERSION: String by rootProject.extra

// This trick hides common tasks in the IDEA list.
tasks.configureEach {
group = null
Expand Down Expand Up @@ -38,10 +40,7 @@ dependencies {
addDependentFabricModule("fabric-renderer-api-v1")
addDependentFabricModule("fabric-rendering-data-attachment-v1")

modCompileOnly("net.fabricmc.fabric-api:fabric-renderer-api-v1:3.2.9+1172e897d7")
implementation(group = "com.lodborg", name = "interval-tree", version = "1.0.0")

modImplementation(/*files(rootDir.resolve("sodium-fabric.jar"))*/ "maven.modrinth:sodium:mc1.21-0.6.0-beta.1-fabric")
modImplementation("maven.modrinth:sodium:$SODIUM_VERSION-fabric")
}

tasks.withType<AbstractRemapJarTask>().forEach {
Expand All @@ -50,10 +49,10 @@ tasks.withType<AbstractRemapJarTask>().forEach {

loom {
mixin {
defaultRefmapName = "sodium-extra.refmap.json"
defaultRefmapName = "${rootProject.name}.refmap.json"
}

accessWidenerPath = file("src/main/resources/sodium-extra.accesswidener")
accessWidenerPath = file("src/main/resources/${rootProject.name}.accesswidener")
}

publishing {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package me.flashyreese.mods.sodiumextra.client.render.vertex.formats;

import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.VertexFormat;
import net.caffeinemc.mods.sodium.api.math.MatrixHelper;
import net.caffeinemc.mods.sodium.api.vertex.format.VertexFormatDescription;
import net.caffeinemc.mods.sodium.api.vertex.format.VertexFormatRegistry;
import org.joml.Matrix4f;
import org.lwjgl.system.MemoryUtil;

public class TextureColorVertex {
public static final VertexFormatDescription FORMAT = VertexFormatRegistry.instance().get(DefaultVertexFormat.POSITION_TEX_COLOR);
public static final VertexFormat FORMAT = DefaultVertexFormat.POSITION_TEX_COLOR;

public static final int STRIDE = 24;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package me.flashyreese.mods.sodiumextra.client.render.vertex.formats;

import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.VertexFormat;
import net.caffeinemc.mods.sodium.api.math.MatrixHelper;
import net.caffeinemc.mods.sodium.api.vertex.format.VertexFormatDescription;
import net.caffeinemc.mods.sodium.api.vertex.format.VertexFormatRegistry;
import org.joml.Matrix4f;
import org.lwjgl.system.MemoryUtil;

public class TextureVertex {
public static final VertexFormatDescription FORMAT = VertexFormatRegistry.instance().get(DefaultVertexFormat.POSITION_TEX);
public static final VertexFormat FORMAT = DefaultVertexFormat.POSITION_TEX;

public static final int STRIDE = 20;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package me.flashyreese.mods.sodiumextra.client.render.vertex.formats;

import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.VertexFormat;
import net.caffeinemc.mods.sodium.api.vertex.attributes.common.ColorAttribute;
import net.caffeinemc.mods.sodium.api.vertex.attributes.common.LightAttribute;
import net.caffeinemc.mods.sodium.api.vertex.attributes.common.PositionAttribute;
import net.caffeinemc.mods.sodium.api.vertex.attributes.common.TextureAttribute;
import net.caffeinemc.mods.sodium.api.vertex.format.VertexFormatDescription;
import net.caffeinemc.mods.sodium.api.vertex.format.VertexFormatRegistry;
import org.lwjgl.system.MemoryUtil;

public final class WeatherVertex {
public static final VertexFormatDescription FORMAT = VertexFormatRegistry.instance().get(DefaultVertexFormat.PARTICLE);
public static final VertexFormat FORMAT = DefaultVertexFormat.PARTICLE;
public static final int STRIDE = 28;
private static final int OFFSET_POSITION = 0;
private static final int OFFSET_TEXTURE = 12;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package me.flashyreese.mods.sodiumextra.compat;

import net.caffeinemc.mods.sodium.api.vertex.format.common.ModelVertex;
import net.caffeinemc.mods.sodium.api.vertex.format.common.EntityVertex;
import net.caffeinemc.mods.sodium.api.vertex.serializer.VertexSerializer;
import org.lwjgl.system.MemoryUtil;

Expand All @@ -12,7 +12,7 @@ public void serialize(long src, long dst, int vertexCount) {
// todo: overlay src + 24L
MemoryUtil.memCopy(src + 28L, dst + 24L, 8); // Copies light and normal

src += ModelVertex.STRIDE;
src += EntityVertex.STRIDE;
dst += IrisCompat.getTerrainFormat().getVertexSize();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import net.caffeinemc.mods.sodium.api.math.MatrixHelper;
import net.caffeinemc.mods.sodium.api.util.ColorARGB;
import net.caffeinemc.mods.sodium.api.vertex.buffer.VertexBufferWriter;
import net.caffeinemc.mods.sodium.api.vertex.format.common.ModelVertex;
import net.caffeinemc.mods.sodium.api.vertex.format.common.EntityVertex;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.MultiBufferSource;
Expand Down Expand Up @@ -59,11 +59,11 @@ private static void optimizeRenderBeam(PoseStack poseStack, MultiBufferSource mu
float innerV1 = (float) maxY * heightScale * (0.5F / innerRadius) + innerV2;

try (MemoryStack stack = MemoryStack.stackPush()) {
long buffer = stack.nmalloc(2 * 16 * ModelVertex.STRIDE);
long buffer = stack.nmalloc(2 * 16 * EntityVertex.STRIDE);
long ptr = buffer;
// Note: ModelVertex color takes in ABGR
ptr = writeBeamLayerVertices(ptr, poseStack, ColorARGB.toABGR(color), yOffset, height, 0.0F, innerRadius, innerRadius, 0.0F, innerX3, 0.0F, 0.0F, innerZ4, innerV1, innerV2);
VertexBufferWriter.of(multiBufferSource.getBuffer(RenderType.beaconBeam(resourceLocation, false))).push(stack, buffer, 16, ModelVertex.FORMAT);
VertexBufferWriter.of(multiBufferSource.getBuffer(RenderType.beaconBeam(resourceLocation, false))).push(stack, buffer, 16, EntityVertex.FORMAT);

poseStack.popPose();
innerX1 = -outerRadius;
Expand All @@ -75,7 +75,7 @@ private static void optimizeRenderBeam(PoseStack poseStack, MultiBufferSource mu

buffer = ptr;
ptr = writeBeamLayerVertices(ptr, poseStack, ColorARGB.toABGR(color, 32), yOffset, height, innerX1, outerZ1, outerRadius, innerZ2, innerX3, outerRadius, outerRadius, outerRadius, innerV1, innerV2);
VertexBufferWriter.of(multiBufferSource.getBuffer(RenderType.beaconBeam(resourceLocation, true))).push(stack, buffer, 16, ModelVertex.FORMAT);
VertexBufferWriter.of(multiBufferSource.getBuffer(RenderType.beaconBeam(resourceLocation, true))).push(stack, buffer, 16, EntityVertex.FORMAT);
}
poseStack.popPose();
}
Expand Down Expand Up @@ -116,8 +116,8 @@ private static long transformAndWriteVertex(long ptr, Matrix4f positionMatrix, f
float transformedY = MatrixHelper.transformPositionY(positionMatrix, x, y, z);
float transformedZ = MatrixHelper.transformPositionZ(positionMatrix, x, y, z);

ModelVertex.write(ptr, transformedX, transformedY, transformedZ, color, u, v, LightTexture.FULL_BRIGHT, OverlayTexture.NO_OVERLAY, normal);
ptr += ModelVertex.STRIDE;
EntityVertex.write(ptr, transformedX, transformedY, transformedZ, color, u, v, LightTexture.FULL_BRIGHT, OverlayTexture.NO_OVERLAY, normal);
ptr += EntityVertex.STRIDE;
return ptr;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package me.flashyreese.mods.sodiumextra.mixin.optimizations.beacon_beam_rendering;

import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.VertexFormat;
import it.unimi.dsi.fastutil.longs.Long2ReferenceMap;
import me.flashyreese.mods.sodiumextra.compat.IrisCompat;
import me.flashyreese.mods.sodiumextra.compat.ModelVertexToTerrainSerializer;
import net.caffeinemc.mods.sodium.client.render.vertex.serializers.VertexSerializerRegistryImpl;
import net.caffeinemc.mods.sodium.api.vertex.format.VertexFormatDescription;
import net.caffeinemc.mods.sodium.api.vertex.format.VertexFormatRegistry;
import net.caffeinemc.mods.sodium.api.vertex.serializer.VertexSerializer;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -23,14 +22,14 @@ public class MixinVertexSerializerRegistryImpl {
private Long2ReferenceMap<VertexSerializer> cache;

@Shadow
private static long createKey(VertexFormatDescription a, VertexFormatDescription b) {
private static long createKey(VertexFormat a, VertexFormat b) {
return 0;
}

@Inject(method = "<init>", at = @At("TAIL"))
private void putSerializerIris(CallbackInfo ci) {
if (IrisCompat.isIrisPresent()) {
this.cache.put(createKey(VertexFormatRegistry.instance().get(DefaultVertexFormat.NEW_ENTITY), VertexFormatRegistry.instance().get(IrisCompat.getTerrainFormat())), new ModelVertexToTerrainSerializer());
this.cache.put(createKey(DefaultVertexFormat.NEW_ENTITY, IrisCompat.getTerrainFormat()), new ModelVertexToTerrainSerializer());
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.flashyreese.mods.sodiumextra.mixin.sodium.resolution;

import com.mojang.blaze3d.platform.Monitor;
import com.mojang.blaze3d.platform.VideoMode;
import com.mojang.blaze3d.platform.Window;
import me.flashyreese.mods.sodiumextra.client.gui.options.control.SliderControlExtended;
Expand Down Expand Up @@ -31,7 +32,7 @@ public class MixinSodiumGameOptionPages {
private static MinecraftOptionsStorage vanillaOpts;

@Inject(method = "general", at = @At(value = "INVOKE", target = "Lnet/caffeinemc/mods/sodium/client/gui/options/OptionGroup;createBuilder()Lnet/caffeinemc/mods/sodium/client/gui/options/OptionGroup$Builder;", ordinal = 1, shift = At.Shift.BEFORE), locals = LocalCapture.CAPTURE_FAILSOFT, remap = false)
private static void general(CallbackInfoReturnable<OptionPage> cir, List<OptionGroup> groups) {
private static void general(CallbackInfoReturnable<OptionPage> cir, Monitor monitor, List<OptionGroup> groups) {
Window window = Minecraft.getInstance().getWindow();

groups.add(OptionGroup.createBuilder()
Expand Down
13 changes: 6 additions & 7 deletions fabric/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ val FABRIC_LOADER_VERSION: String by rootProject.extra
val FABRIC_API_VERSION: String by rootProject.extra
val MOD_VERSION: String by rootProject.extra

val SODIUM_VERSION: String by rootProject.extra

base {
archivesName.set("sodium-extra-fabric")
archivesName.set("${project.name}-fabric")
}

dependencies {
Expand All @@ -36,19 +38,16 @@ dependencies {
addEmbeddedFabricModule("fabric-rendering-data-attachment-v1")
addEmbeddedFabricModule("fabric-rendering-fluids-v1")
addEmbeddedFabricModule("fabric-resource-loader-v0")
include(implementation(group = "com.lodborg", name = "interval-tree", version = "1.0.0"))

implementation("com.google.code.findbugs:jsr305:3.0.1")
compileOnly(project(":common"))
modImplementation(/*files(rootDir.resolve("sodium-fabric.jar"))*/ "maven.modrinth:sodium:mc1.21-0.6.0-beta.1-fabric")
modImplementation("maven.modrinth:sodium:$SODIUM_VERSION-fabric")

}

loom {
accessWidenerPath.set(project(":common").file("src/main/resources/sodium-extra.accesswidener"))
accessWidenerPath.set(project(":common").file("src/main/resources/${rootProject.name}.accesswidener"))

@Suppress("UnstableApiUsage")
mixin { defaultRefmapName.set("sodium-extra.refmap.json") }
mixin { defaultRefmapName.set("${rootProject.name}.refmap.json") }

runs {
named("client") {
Expand Down
3 changes: 0 additions & 3 deletions gradle.properties

This file was deleted.

8 changes: 5 additions & 3 deletions neoforge/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ val PARCHMENT_VERSION: String? by rootProject.extra
val NEOFORGE_VERSION: String by rootProject.extra
val MOD_VERSION: String by rootProject.extra

val SODIUM_VERSION: String by rootProject.extra

base {
archivesName = "sodium-extra-neoforge"
archivesName = "${rootProject.name}-neoforge"
}

repositories {
Expand Down Expand Up @@ -61,7 +63,7 @@ neoForge {
}

mods {
create("sodium_extra") {
create(project.name) {
sourceSet(sourceSets.main.get())
}
}
Expand All @@ -83,7 +85,7 @@ tasks.named("compileTestJava").configure {

dependencies {
compileOnly(project(":common"))
implementation(/*files(rootDir.resolve("sodium-neo.jar"))*/ "maven.modrinth:sodium:mc1.21-0.6.0-beta.1-neoforge")
implementation("maven.modrinth:sodium:$SODIUM_VERSION-neoforge")
}

// NeoGradle compiles the game, but we don't want to add our common code to the game's code
Expand Down
Loading

0 comments on commit cdaa048

Please sign in to comment.