Skip to content

Commit

Permalink
## BetterF3 v1.3.3 for Minecraft 1.19.1/2
Browse files Browse the repository at this point in the history
Published 2022-09-13

### Added
* In-Game Tick Display [#98](cominixo/BetterF3#98)
* Automatically opening the profiler and TPS graphs [#9](cominixo/BetterF3#9)
* Changelogs to the documentation
* Added an option to hide the bossbar
### Updated
* GitHub Workflow
### Fixed
* Maximum FPS does not display [#102](cominixo/BetterF3#102)
* Info colors can't change [#101](cominixo/BetterF3#101)
* Left Module Background Cut Off [#94](cominixo/BetterF3#94)
* String error [#106](cominixo/BetterF3#106)

Full Changelog: [`v1.3.2...v1.3.3`](cominixo/BetterF3@v1.3.2...v1.3.3)
  • Loading branch information
TreyRuffy committed Sep 13, 2022
1 parent ec9c84b commit bb8bf05
Show file tree
Hide file tree
Showing 36 changed files with 901 additions and 207 deletions.
69 changes: 56 additions & 13 deletions .github/workflows/build-project.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,78 @@
name: "Build the project" # Builds the project and archives the checkstyle results
on: [pull_request, push]
name: Build BetterF3
# Builds the project and archives the checkstyle results

on:
pull_request:
push:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'LICENSE.txt'
- 'CONTRIBUTING.md'
workflow_dispatch:
inputs:
release:
description: Publish a Release
required: true
default: false
type: boolean

jobs:
build:
name: "Build"
name: Build the Project
runs-on: ubuntu-latest
steps:
- name: "Checkout this repository"
- name: Checkout this repository
uses: actions/checkout@v2

- name: "Setup Java 17"
- name: Setup Java 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '17'

- name: "Check gradle validation"
- name: Check gradle validation
uses: gradle/wrapper-validation-action@v1

- name: "Make Gradle Wrapper executable"
- name: Make Gradle Wrapper executable
run: chmod +x ./gradlew

- name: "Build with Gradle"
run: ./gradlew build
- name: Build with Gradle
uses: gradle/gradle-build-action@v2
with:
arguments: build

- name: Setup Environment Variables
run: |
cat $GITHUB_WORKSPACE/gradle.properties | grep ^supported_minecraft_versions >> $GITHUB_ENV
cat $GITHUB_WORKSPACE/gradle.properties | grep ^minecraft_version >> $GITHUB_ENV
cat $GITHUB_WORKSPACE/gradle.properties | grep ^mod_version >> $GITHUB_ENV
echo "package_name=BetterF3-${{ env.mod_version }}-mc${{ env.minecraft_version }}" >> $GITHUB_ENV
- name: "Archives Checkstyle results"
uses: "actions/upload-artifact@v2"
- name: Archives Results
uses: actions/upload-artifact@v3
with:
name: "test-results"
name: ${{ env.package_name }}
path: |
build/reports/
**/build/reports/
build/libs
**/build/libs/
**/build/libs/
- name: Release Version to GitHub
uses: softprops/action-gh-release@v1
if: ${{ github.event.inputs.release }}
with:
body_path: $GITHUB_WORKSPACE/build/CHANGELOG.md
files: |
**/build/libs/BetterF3-*-*-*.jar
- name: Release Version to 3rd Parties
uses: gradle/gradle-build-action@v2
if: ${{ github.event.inputs.release }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CURSE_API_KEY: ${{ secrets.CURSE_API_KEY }}
MODRINTH_API_KEY: ${{ secrets.MODRINTH_API_KEY }}
with:
arguments: publish publishUnified
31 changes: 30 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import java.text.SimpleDateFormat

plugins {
id "architectury-plugin" version "3.4-SNAPSHOT" // Uses Architectury plugin https://github.com/architectury/architectury-plugin
id "dev.architectury.loom" version "0.12.0-SNAPSHOT" apply false // Uses Architectury Loom
// (fork of Fabric Loom) https://github.com/architectury/architectury-loom - does not apply to root project
id "net.kyori.indra" version "2.1.1" // Uses Indra plugin
id "net.kyori.indra.git" version "2.1.1" // Uses Indra Git plugin
id "net.kyori.indra.checkstyle" version "2.1.1" // Uses Indra Checkstyle plugin
id "me.shedaniel.unified-publishing" version "0.1.+" apply false // Uses Unified Publishing plugin
}

architectury {
Expand All @@ -13,6 +16,7 @@ architectury {

subprojects {
apply plugin: "dev.architectury.loom" // Applies Architectury Loom to subprojects
apply plugin: "me.shedaniel.unified-publishing" // Applies Unified Publishing to subprojects

loom {
silentMojangMappingsLicense() // Silences the annoying as hell Mojang License text
Expand All @@ -23,6 +27,31 @@ subprojects {
//mappings loom.officialMojangMappings() // Maps Minecraft so we can tell what classes are what - official mappings
mappings "net.fabricmc:yarn:${rootProject.yarn_version}:v2" // Alternative, open, mappings from Fabric
}

ext {
releaseChangelog = {
def dateFormat = new SimpleDateFormat("yyyy-MM-dd")
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"))
def date = dateFormat.format(new Date())
def changelogFormatText = file("../docs/changelogs/format.md").text.trim()
def changelogText = file("../docs/changelogs/${project.version}.md").text.trim()
def lastVersion = changelogText.split("\n")[0].split("=")[1].trim()
def changelog = changelogFormatText
.replace("%date%", date)
.replace("%changelog%", changelogText)
.replace("%version%", project.version)
.replace("%mc_versions%", rootProject.supported_minecraft_versions)
.replace("%last_version%", lastVersion)
StringBuilder changelogBuilder = new StringBuilder()
for (String line : changelog.split("\n")) {
if (!line.startsWith("!"))
changelogBuilder.append(line).append("\n")
}
if (!rootProject.buildDir.exists()) rootProject.buildDir.mkdirs()
new File(rootProject.buildDir, "CHANGELOG.md").text = changelogBuilder.toString().trim()
return changelogBuilder.toString().trim()
}
}
}

allprojects {
Expand Down Expand Up @@ -53,4 +82,4 @@ allprojects {
options.compilerArgs += "-Xlint:-processing" // Fixes "no processor claimed any of these annotations" warning
}

}
}
16 changes: 4 additions & 12 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ dependencies {
exclude module: 'fabric-api'
}

implementation 'com.electronwill.night-config:json:3.6.5'
shadowCommon "com.electronwill.night-config:json:3.6.5"
implementation 'com.electronwill.night-config:json:3.6.6'
shadowCommon 'com.electronwill.night-config:json:3.6.6'
}

loom {
Expand All @@ -28,15 +28,7 @@ loom {
}

architectury {
if (rootProject.forge_enabled.toBoolean()) {
common("fabric","forge")
} else {
common("fabric")
}
}

java {
withSourcesJar()
common(rootProject.platforms.split(","))
}

publishing {
Expand All @@ -47,4 +39,4 @@ publishing {
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,22 @@ private GeneralOptions() {
*/
public static int backgroundColor = 0x6F505050;
/**
* Hides the sidebar while looking at F3.
* Hides the sidebar while looking at the F3 menu.
*/
public static boolean hideSidebar = true;

/**
* Hides the bossbar while looking at the F3 menu.
*/
public static boolean hideBossbar = true;

/**
* Always shows the profiler when using F3.
*/
public static boolean alwaysEnableProfiler = false;

/**
* Always shows the TPS graph when using F3.
*/
public static boolean alwaysEnableTPS = false;
}
128 changes: 123 additions & 5 deletions common/src/main/java/me/cominixo/betterf3/config/ModConfigFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@
import java.util.ArrayList;
import java.util.List;
import me.cominixo.betterf3.modules.BaseModule;
import me.cominixo.betterf3.modules.ChunksModule;
import me.cominixo.betterf3.modules.CoordsModule;
import me.cominixo.betterf3.modules.EmptyModule;
import me.cominixo.betterf3.modules.EntityModule;
import me.cominixo.betterf3.modules.FpsModule;
import me.cominixo.betterf3.modules.HelpModule;
import me.cominixo.betterf3.modules.SoundModule;
import me.cominixo.betterf3.modules.SystemModule;
import me.cominixo.betterf3.utils.DebugLine;
import net.minecraft.text.TextColor;

Expand Down Expand Up @@ -43,6 +48,9 @@ private ModConfigFile() {
general.set("fontScale", GeneralOptions.fontScale);
general.set("background_color", GeneralOptions.backgroundColor);
general.set("hide_sidebar", GeneralOptions.hideSidebar);
general.set("hide_bossbar", GeneralOptions.hideBossbar);
general.set("always_show_profiler", GeneralOptions.alwaysEnableProfiler);
general.set("always_show_tps", GeneralOptions.alwaysEnableTPS);

final List<Config> configsLeft = new ArrayList<>();

Expand Down Expand Up @@ -141,6 +149,48 @@ public static void load(final FileType filetype) {
coordsModule.defaultColorZ.getRgb()));
}

if (module instanceof SoundModule soundModule) {
if (soundModule.defaultMaximumColor != null)
soundModule.maximumColor = TextColor.fromRgb(moduleConfig.getOrElse("maximum_color",
soundModule.defaultMaximumColor.getRgb()));
}

if (module instanceof EntityModule entityModule) {
if (entityModule.defaultTotalColor != null)
entityModule.totalColor = TextColor.fromRgb(moduleConfig.getOrElse("total_entities_color",
entityModule.defaultTotalColor.getRgb()));
}

if (module instanceof HelpModule helpModule) {
if (helpModule.defaultEnabledColor != null)
helpModule.enabledColor = TextColor.fromRgb(moduleConfig.getOrElse("enabled_color",
helpModule.defaultEnabledColor.getRgb()));
if (helpModule.defaultDisabledColor != null)
helpModule.disabledColor = TextColor.fromRgb(moduleConfig.getOrElse("disabled_color",
helpModule.defaultDisabledColor.getRgb()));
}

if (module instanceof ChunksModule chunkModule) {
if (chunkModule.defaultEnabledColor != null)
chunkModule.enabledColor = TextColor.fromRgb(moduleConfig.getOrElse("chunks_enabled_color",
chunkModule.defaultEnabledColor.getRgb()));
if (chunkModule.defaultDisabledColor != null)
chunkModule.disabledColor = TextColor.fromRgb(moduleConfig.getOrElse("chunks_disabled_color",
chunkModule.defaultDisabledColor.getRgb()));
if (chunkModule.defaultTotalColor != null)
chunkModule.totalColor = TextColor.fromRgb(moduleConfig.getOrElse("total_chunks_color",
chunkModule.defaultTotalColor.getRgb()));
}

if (module instanceof SystemModule systemModule) {
if (systemModule.memoryColorToggle == null) {
systemModule.memoryColorToggle = moduleConfig.getOrElse("memory_color_toggle", systemModule.defaultMemoryColorToggle);
}
if (systemModule.timeFormat == null) {
systemModule.timeFormat = moduleConfig.getOrElse("time_format", systemModule.defaultTimeFormat);
}
}

module.enabled = moduleConfig.getOrElse("enabled", true);

}
Expand All @@ -166,10 +216,6 @@ public static void load(final FileType filetype) {
}
}

if (!modulesLeft.isEmpty()) {
BaseModule.modules = modulesLeft;
}

final List<Config> modulesRightConfig = config.getOrElse("modules_right", () -> null);

if (modulesRightConfig != null) {
Expand All @@ -187,7 +233,8 @@ public static void load(final FileType filetype) {
}
}

if (!modulesRight.isEmpty()) {
if (!modulesLeft.isEmpty() || !modulesRight.isEmpty()) {
BaseModule.modules = modulesLeft;
BaseModule.modulesRight = modulesRight;
}

Expand Down Expand Up @@ -232,6 +279,9 @@ public static void load(final FileType filetype) {
GeneralOptions.fontScale = general.getOrElse("fontScale", 1.0);
GeneralOptions.backgroundColor = general.getOrElse("background_color", 0x6F505050);
GeneralOptions.hideSidebar = general.getOrElse("hide_sidebar", true);
GeneralOptions.hideBossbar = general.getOrElse("hide_bossbar", true);
GeneralOptions.alwaysEnableProfiler = general.getOrElse("always_show_profiler", false);
GeneralOptions.alwaysEnableTPS = general.getOrElse("always_show_tps", false);
}

config.close();
Expand Down Expand Up @@ -300,6 +350,48 @@ private static BaseModule loadModule(final Config moduleConfig) {
emptyModule.emptyLines = moduleConfig.getOrElse("empty_lines", 1);
}

if (baseModule instanceof SoundModule soundModule) {
if (soundModule.defaultMaximumColor != null)
soundModule.maximumColor = TextColor.fromRgb(moduleConfig.getOrElse("maximum_color",
soundModule.defaultMaximumColor.getRgb()));
}

if (baseModule instanceof EntityModule entityModule) {
if (entityModule.defaultTotalColor != null)
entityModule.totalColor = TextColor.fromRgb(moduleConfig.getOrElse("total_entities_color",
entityModule.defaultTotalColor.getRgb()));
}

if (baseModule instanceof HelpModule helpModule) {
if (helpModule.defaultEnabledColor != null)
helpModule.enabledColor = TextColor.fromRgb(moduleConfig.getOrElse("enabled_color",
helpModule.defaultEnabledColor.getRgb()));
if (helpModule.defaultDisabledColor != null)
helpModule.disabledColor = TextColor.fromRgb(moduleConfig.getOrElse("disabled_color",
helpModule.defaultDisabledColor.getRgb()));
}

if (baseModule instanceof ChunksModule chunkModule) {
if (chunkModule.defaultEnabledColor != null)
chunkModule.enabledColor = TextColor.fromRgb(moduleConfig.getOrElse("chunks_enabled_color",
chunkModule.defaultEnabledColor.getRgb()));
if (chunkModule.defaultDisabledColor != null)
chunkModule.disabledColor = TextColor.fromRgb(moduleConfig.getOrElse("chunks_disabled_color",
chunkModule.defaultDisabledColor.getRgb()));
if (chunkModule.defaultTotalColor != null)
chunkModule.totalColor = TextColor.fromRgb(moduleConfig.getOrElse("total_chunks_color",
chunkModule.defaultTotalColor.getRgb()));
}

if (baseModule instanceof SystemModule systemModule) {
if (systemModule.memoryColorToggle == null) {
systemModule.memoryColorToggle = moduleConfig.getOrElse("memory_color_toggle", systemModule.defaultMemoryColorToggle);
}
if (systemModule.timeFormat == null) {
systemModule.timeFormat = moduleConfig.getOrElse("time_format", systemModule.defaultTimeFormat);
}
}

baseModule.enabled = moduleConfig.getOrElse("enabled", true);
return baseModule;
}
Expand Down Expand Up @@ -352,6 +444,32 @@ private static Config saveModule(final BaseModule module) {
moduleConfig.set("empty_lines", emptyModule.emptyLines);
}

if (module instanceof SoundModule soundModule) {
if (soundModule.maximumColor != null)
moduleConfig.set("maximum_color", soundModule.maximumColor.getRgb());
}

if (module instanceof EntityModule entityModule) {
if (entityModule.totalColor != null)
moduleConfig.set("total_entities_color", entityModule.totalColor.getRgb());
}

if (module instanceof HelpModule helpModule) {
if (helpModule.enabledColor != null)
moduleConfig.set("enabled_color", helpModule.enabledColor.getRgb());
if (helpModule.disabledColor != null)
moduleConfig.set("disabled_color", helpModule.disabledColor.getRgb());
}

if (module instanceof ChunksModule chunkModule) {
if (chunkModule.enabledColor != null)
moduleConfig.set("chunks_enabled_color", chunkModule.enabledColor.getRgb());
if (chunkModule.disabledColor != null)
moduleConfig.set("chunks_disabled_color", chunkModule.disabledColor.getRgb());
if (chunkModule.totalColor != null)
moduleConfig.set("total_chunks_color", chunkModule.totalColor.getRgb());
}

moduleConfig.set("enabled", module.enabled);
moduleConfig.set("lines", lines);

Expand Down
Loading

0 comments on commit bb8bf05

Please sign in to comment.