-
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '1.21/dev' into 1.21/stable
- Loading branch information
Showing
138 changed files
with
2,555 additions
and
1,337 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ on: | |
- published | ||
|
||
jobs: | ||
publish: | ||
build: | ||
if: github.repository_owner == 'FlashyReese' | ||
runs-on: self-hosted | ||
steps: | ||
|
@@ -25,8 +25,19 @@ jobs: | |
env: | ||
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | ||
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} | ||
- name: Publish to Modrinth & CurseForge | ||
uses: Kir-Antipov/[email protected] | ||
publish: | ||
needs: build | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
matrix: | ||
include: | ||
- platform: fabric | ||
name: Fabric | ||
- platform: neoforge | ||
name: NeoForge | ||
steps: | ||
- name: Publish ${{ matrix.name }} to Modrinth, CurseForge & GitHub | ||
uses: Kir-Antipov/[email protected] | ||
with: | ||
modrinth-id: PtjYWJkn | ||
modrinth-token: ${{ secrets.MODRINTH_TOKEN }} | ||
|
@@ -36,11 +47,21 @@ jobs: | |
|
||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
name: '[${{ matrix.name }}] ${{ github.event.release.name }}' | ||
version: '${{ github.event.release.tag_name }}+${{ matrix.platform }}' | ||
version-type: release | ||
loaders: fabric | ||
|
||
loaders: ${{ matrix.platform }} | ||
|
||
dependencies: | | ||
sodium | depends | * | ||
fabric-api | depends | * | ||
reeses-sodium-options | recommends | * | ||
irisshaders | recommends | * | ||
iris | recommends | * | ||
files: | | ||
${{ matrix.platform }}/build/libs/!(*-@(dev|sources|javadoc|dev-shadow)).jar | ||
${{ matrix.platform }}/build/libs/*-@(dev|sources|javadoc|dev-shadow).jar | ||
version-resolver: latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
plugins { | ||
id("java") | ||
id("fabric-loom") version ("1.7.2") apply (false) | ||
} | ||
|
||
val MINECRAFT_VERSION by extra { "1.21.1" } | ||
val NEOFORGE_VERSION by extra { "21.1.23" } | ||
val FABRIC_LOADER_VERSION by extra { "0.16.2" } | ||
val FABRIC_API_VERSION by extra { "0.102.1+1.21.1" } | ||
|
||
// This value can be set to null to disable Parchment. | ||
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 | ||
|
||
allprojects { | ||
apply(plugin = "java") | ||
apply(plugin = "maven-publish") | ||
group = maven_group | ||
version = createVersionString() | ||
} | ||
|
||
tasks.withType<JavaCompile> { | ||
options.encoding = "UTF-8" | ||
} | ||
|
||
subprojects { | ||
apply(plugin = "maven-publish") | ||
|
||
repositories { | ||
maven("https://maven.parchmentmc.org/") | ||
maven("https://api.modrinth.com/maven") | ||
} | ||
|
||
base { | ||
archivesName = "$archives_name-${project.name}" | ||
} | ||
|
||
java.toolchain.languageVersion = JavaLanguageVersion.of(21) | ||
|
||
tasks.processResources { | ||
filesMatching("META-INF/neoforge.mods.toml") { | ||
expand(mapOf("version" to createVersionString())) | ||
} | ||
} | ||
|
||
version = createVersionString() | ||
group = "me.flashyreese.mods" | ||
|
||
tasks.withType<JavaCompile> { | ||
options.encoding = "UTF-8" | ||
options.release.set(21) | ||
} | ||
|
||
tasks.withType<GenerateModuleMetadata>().configureEach { | ||
enabled = false | ||
} | ||
} | ||
|
||
fun createVersionString(): String { | ||
val builder = StringBuilder() | ||
|
||
val isReleaseBuild = project.hasProperty("build.release") | ||
val buildId = System.getenv("GITHUB_RUN_NUMBER") | ||
|
||
if (isReleaseBuild) { | ||
builder.append(MOD_VERSION) | ||
} else { | ||
builder.append(MOD_VERSION.split('-')[0]) | ||
builder.append("-snapshot") | ||
} | ||
|
||
builder.append("+mc").append(MINECRAFT_VERSION) | ||
|
||
if (!isReleaseBuild) { | ||
if (buildId != null) { | ||
builder.append("-build.$buildId") | ||
} else { | ||
builder.append("-local") | ||
} | ||
} | ||
|
||
return builder.toString() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import net.fabricmc.loom.task.AbstractRemapJarTask | ||
|
||
plugins { | ||
id("java") | ||
id("idea") | ||
id("fabric-loom") version "1.7.2" | ||
} | ||
|
||
val MINECRAFT_VERSION: String by rootProject.extra | ||
val PARCHMENT_VERSION: String? by rootProject.extra | ||
val FABRIC_LOADER_VERSION: String by rootProject.extra | ||
val FABRIC_API_VERSION: String by rootProject.extra | ||
|
||
// This trick hides common tasks in the IDEA list. | ||
tasks.configureEach { | ||
group = null | ||
} | ||
|
||
dependencies { | ||
minecraft(group = "com.mojang", name = "minecraft", version = MINECRAFT_VERSION) | ||
mappings(loom.layered() { | ||
officialMojangMappings() | ||
if (PARCHMENT_VERSION != null) { | ||
parchment("org.parchmentmc.data:parchment-${MINECRAFT_VERSION}:${PARCHMENT_VERSION}@zip") | ||
} | ||
}) | ||
compileOnly("io.github.llamalad7:mixinextras-common:0.3.5") | ||
annotationProcessor("io.github.llamalad7:mixinextras-common:0.3.5") | ||
compileOnly("net.fabricmc:sponge-mixin:0.13.2+mixin.0.8.5") | ||
|
||
fun addDependentFabricModule(name: String) { | ||
val module = fabricApi.module(name, FABRIC_API_VERSION) | ||
modCompileOnly(module) | ||
} | ||
|
||
addDependentFabricModule("fabric-api-base") | ||
addDependentFabricModule("fabric-block-view-api-v2") | ||
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") | ||
} | ||
|
||
tasks.withType<AbstractRemapJarTask>().forEach { | ||
it.targetNamespace = "named" | ||
} | ||
|
||
loom { | ||
mixin { | ||
defaultRefmapName = "sodium-extra.refmap.json" | ||
} | ||
|
||
accessWidenerPath = file("src/main/resources/sodium-extra.accesswidener") | ||
} | ||
|
||
publishing { | ||
publications { | ||
create<MavenPublication>("mavenJava") { | ||
artifactId = base.archivesName.get() | ||
from(components["java"]) | ||
} | ||
} | ||
|
||
repositories { | ||
maven { | ||
name = "FlashyReeseReleases" | ||
url = uri("https://maven.flashyreese.me/releases") | ||
credentials { | ||
username = System.getenv("MAVEN_USERNAME") | ||
password = System.getenv("MAVEN_PASSWORD") | ||
} | ||
} | ||
maven { | ||
name = "FlashyReeseSnapshots" | ||
url = uri("https://maven.flashyreese.me/snapshots") | ||
credentials { | ||
username = System.getenv("MAVEN_USERNAME") | ||
password = System.getenv("MAVEN_PASSWORD") | ||
} | ||
} | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
common/src/main/java/me/flashyreese/mods/sodiumextra/client/ClientTickHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package me.flashyreese.mods.sodiumextra.client; | ||
|
||
import com.google.common.collect.EvictingQueue; | ||
import me.flashyreese.mods.sodiumextra.mixin.gui.MinecraftClientAccessor; | ||
import net.minecraft.client.Minecraft; | ||
|
||
import java.util.Comparator; | ||
import java.util.Queue; | ||
|
||
public class ClientTickHandler { | ||
private final Queue<Integer> fpsQueue = EvictingQueue.create(200); | ||
private int averageFps, lowestFps, highestFps; | ||
|
||
public void onClientTick(Minecraft client) { | ||
int currentFPS = MinecraftClientAccessor.getFPS(); | ||
this.fpsQueue.add(currentFPS); | ||
this.averageFps = (int) this.fpsQueue.stream().mapToInt(Integer::intValue).average().orElse(0); | ||
this.lowestFps = this.fpsQueue.stream().min(Comparator.comparingInt(e -> e)).orElse(0); | ||
this.highestFps = this.fpsQueue.stream().max(Comparator.comparingInt(e -> e)).orElse(0); | ||
} | ||
|
||
public int getAverageFps() { | ||
return this.averageFps; | ||
} | ||
|
||
public int getLowestFps() { | ||
return this.lowestFps; | ||
} | ||
|
||
public int getHighestFps() { | ||
return this.highestFps; | ||
} | ||
} |
Oops, something went wrong.