Skip to content

Commit

Permalink
update to 1.21.1
Browse files Browse the repository at this point in the history
  • Loading branch information
PinkGoosik committed Nov 18, 2024
1 parent c0214b3 commit b6a7dd7
Show file tree
Hide file tree
Showing 11 changed files with 126 additions and 104 deletions.
16 changes: 7 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,25 @@ jobs:
build:
strategy:
matrix:
java: [ 17 ]
os: [ ubuntu-22.04 ]
runs-on: ${{ matrix.os }}
java: [ 21 ]
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Validate gradle wrapper
uses: gradle/wrapper-validation-action@v1
uses: gradle/wrapper-validation-action@v2
- name: Setup JDK ${{ matrix.java }}
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'microsoft'
- name: Make gradle wrapper executable
if: ${{ runner.os != 'Windows' }}
run: chmod +x ./gradlew
- name: build
run: ./gradlew build
- name: Capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '17' }}
uses: actions/upload-artifact@v3
if: ${{ matrix.java == '21' }}
uses: actions/upload-artifact@v4
with:
name: Artifacts
path: build/libs/
26 changes: 0 additions & 26 deletions .github/workflows/publish-github.yml

This file was deleted.

44 changes: 0 additions & 44 deletions .github/workflows/publish-modrinth.yml

This file was deleted.

66 changes: 66 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: publish

on:
release:
types:
- published

jobs:
build:
strategy:
matrix:
java: [ 21 ]
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Validate gradle wrapper
uses: gradle/wrapper-validation-action@v2
- name: Setup JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java }}
distribution: 'microsoft'
- name: Make gradle wrapper executable
run: chmod +x ./gradlew
- name: Build
run: ./gradlew build
- uses: BrycensRanch/read-properties-action@v1
id: props
with:
file: gradle.properties
all: true

- name: Publish
uses: Kir-Antipov/[email protected]
with:
modrinth-id: ${{ steps.props.outputs.modrinth_id }}
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}

files: |
build/libs/${{ steps.props.outputs.archives_base_name }}-${{ github.event.release.tag_name }}.jar
build/libs/${{ steps.props.outputs.archives_base_name }}-${{ github.event.release.tag_name }}-sources.jar
version: ${{ github.event.release.tag_name }}

version-type: beta
loaders: |
fabric
game-versions: ${{ steps.props.outputs.minecraft_version_range }}
game-version-filter: releases

dependencies: |
fabric-api
java: |
21
retry-attempts: 0
fail-mode: skip

- name: Upload assets to GitHub
uses: AButler/[email protected]
with:
files: "build/libs/*"
repo-token: ${{ secrets.GH_TOKEN }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ bin/
# fabric

run/
test/
testrun/
28 changes: 16 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "fabric-loom" version "1.4-SNAPSHOT"
id "fabric-loom" version "1.8-SNAPSHOT"
}

version = project.mod_version
Expand All @@ -18,8 +18,6 @@ dependencies {
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api}"
modImplementation include("eu.pb4:placeholder-api:${project.placeholder_api}")
modImplementation include("eu.pb4:polymer-virtual-entity:${project.polymer_version}")

modLocalRuntime "com.terraformersmc:modmenu:9.0.0-pre.1"
}

sourceSets {
Expand All @@ -38,13 +36,13 @@ loom {
testmodClient {
client()
name = "Test Client"
runDir = "test"
runDir = "testrun"
source = sourceSets.testmod
}
testmodServer {
server()
name = "Test Server"
runDir = "test"
runDir = "testrun"
source = sourceSets.testmod
}
}
Expand All @@ -57,20 +55,26 @@ base {
}

processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
def expandProps = [
"version": rootProject.mod_version,
"minecraft_version_range": rootProject.minecraft_version_range,
]

filesMatching(["fabric.mod.json"]) {
expand expandProps
}

inputs.properties(expandProps)
}

tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.options.release = 17
it.options.release = 21
}

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

Expand Down
17 changes: 10 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@ org.gradle.jvmargs = -Xmx2G
org.gradle.parallel = true

# Mod Properties
mod_version = 0.3.1+1.20.3
mod_version = 0.3.1+1.21
maven_group = ru.pinkgoosik
archives_base_name = entity-health-display

minecraft_version_range = >=1.21 <1.21.2
modrinth_id = 84H12Z4u

# Dependencies | Check these on https://fabricmc.net/develop
minecraft_version = 1.20.3
yarn_mappings = 1.20.3+build.1
fabric_loader = 0.15.0
fabric_api = 0.91.1+1.20.3
minecraft_version = 1.21.1
yarn_mappings = 1.21.1+build.3
fabric_loader = 0.16.9
fabric_api = 0.108.0+1.21.1

# https://github.com/Patbox/TextPlaceholderAPI/releases
placeholder_api = 2.3.0+1.20.3
placeholder_api = 2.4.1+1.21
# https://github.com/Patbox/polymer/releases
polymer_version = 0.7.0+1.20.3-rc1
polymer_version = 0.9.18+1.21.1
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 3 additions & 3 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"id": "entity-health-display",
"version": "${version}",
"name": "Entity Health Display",
"description": "Fabric server-side library for displaying entities' health.",
"description": "Fabric server-side library mod for displaying entities' health.",
"authors": [
"PinkGoosik"
],
Expand All @@ -28,7 +28,7 @@
"depends": {
"fabricloader": "*",
"fabric": "*",
"minecraft": ">=1.20.3",
"java": ">=17"
"minecraft": "${minecraft_version_range}",
"java": ">=21"
}
}
21 changes: 21 additions & 0 deletions src/testmod/java/testmod/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package testmod;

import eu.pb4.placeholders.api.TextParserUtils;
import net.fabricmc.api.ModInitializer;
import pinkgoosik.entityhealthdisplay.api.HealthDisplayEvents;

public class Main implements ModInitializer {

@Override
public void onInitialize() {
HealthDisplayEvents.FORMAT_HEALTH_DISPLAY.register((entity, world) -> {
String color = (entity.getMaxHealth() / 2) >= entity.getHealth() ? "<yellow>" : "<green>";
var text = TextParserUtils.formatText("<red>" + entity.getName().getString() + " " + color + String.format("%.1f", entity.getHealth()) + "<white>/<green>" + (int)entity.getMaxHealth() + "<red>❤");
return text;
});

HealthDisplayEvents.SHOULD_DISPLAY_HEALTH.register((entity, world) -> {
return true;
});
}
}
2 changes: 1 addition & 1 deletion src/testmod/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"environment": "*",
"entrypoints": {
"main": [
"test.Main"
"testmod.Main"
]
}
}

0 comments on commit b6a7dd7

Please sign in to comment.