Skip to content

Commit 19c8326

Browse files
Version 2 Alpha 1
2 parents 00cbd5e + 22ce48c commit 19c8326

File tree

68 files changed

+7535
-395
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+7535
-395
lines changed

.github/workflows/build_artifacts.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,28 @@ jobs:
2424
with:
2525
cache-read-only: false
2626

27+
- name: Store short commit hash
28+
run: echo "short_commit_hash=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
29+
2730
- name: Generate resources with Gradle
2831
run: ./gradlew runDatagenClient
2932
env:
33+
CUSTOM_VERSION: ${{ env.short_commit_hash }}
3034
DISABLE_PROPERTIES_UPDATE: true
3135

32-
3336
- name: Build with Gradle
3437
run: ./gradlew build
3538
env:
39+
CUSTOM_VERSION: ${{ env.short_commit_hash }}
40+
DISABLE_PROPERTIES_UPDATE: true
41+
42+
- name: Publish to Maven
43+
run: ./gradlew publishMavenPublicationToOffsetMonkey538Repository
44+
env:
45+
CUSTOM_VERSION: ${{ env.short_commit_hash }}
3646
DISABLE_PROPERTIES_UPDATE: true
47+
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
48+
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
3749

3850
- name: Upload build artifacts
3951
uses: actions/upload-artifact@v4

.github/workflows/docs.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Publish docs
2+
3+
on:
4+
push:
5+
branches:
6+
- "*"
7+
release:
8+
types: [published]
9+
10+
11+
jobs:
12+
publish-docs:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Set url prefix
18+
run: |
19+
if [[ "${{ github.event_name }}" == "push" || "${{ github.event.release.prerelease }}" == "true" ]]; then
20+
echo "url_prefix=staging-" >> "$GITHUB_ENV"
21+
else
22+
echo "url_prefix=" >> "$GITHUB_ENV"
23+
fi
24+
25+
- name: Store short commit hash
26+
run: echo "short_commit_hash=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
27+
28+
- uses: danielr1996/envsubst-action@1.1.0
29+
env:
30+
URL_PREFIX: ${{ env.url_prefix }}
31+
SHORT_COMMIT_HASH: ${{ env.short_commit_hash }}
32+
with:
33+
input: docker-compose-template.yml
34+
output: docker-compose.yml
35+
36+
- name: Login to container registry
37+
uses: docker/login-action@v3
38+
with:
39+
registry: registry.oracle.offsetmonkey538.top
40+
username: ${{ secrets.REGISTRY_USER }}
41+
password: ${{ secrets.REGISTRY_PASSWORD }}
42+
43+
- name: Set up Docker Buildx
44+
uses: docker/setup-buildx-action@v3
45+
46+
- name: Build and push
47+
uses: docker/build-push-action@v6
48+
with:
49+
context: .
50+
push: true
51+
tags: registry.oracle.offsetmonkey538.top/loot-table-modifier/docs:${{ env.short_commit_hash }}
52+
53+
- run: |
54+
tar -czf archive.tar.gz docker-compose.yml && curl -i -X POST -H "Authorization: Bearer $SEELF_TOKEN" -F environment=$SEELF_ENVIRONMENT -F archive=@archive.tar.gz $SEELF_APPLICATION_URL
55+
env:
56+
SEELF_TOKEN: ${{ secrets.SEELF_TOKEN }}
57+
SEELF_ENVIRONMENT: staging
58+
SEELF_APPLICATION_URL: https://seelf.oracle.offsetmonkey538.top/api/v1/apps/300qBnG3t1dOFrUGfw1EeWYwKYA/deployments

.github/workflows/publish.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,26 @@ jobs:
2626
with:
2727
cache-read-only: false
2828

29+
- name: Store short commit hash
30+
run: echo "short_commit_hash=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
31+
2932
- name: Generate resources with Gradle
3033
run: ./gradlew runDatagenClient
3134
env:
35+
CUSTOM_VERSION: ${{ env.short_commit_hash }}
3236
DISABLE_PROPERTIES_UPDATE: true
3337

3438

3539
- name: Build with Gradle
3640
run: ./gradlew build
3741
env:
42+
CUSTOM_VERSION: ${{ env.short_commit_hash }}
3843
DISABLE_PROPERTIES_UPDATE: true
3944

4045
- name: Upload to Modrinth
4146
run: ./gradlew modrinth
4247
env:
48+
CUSTOM_VERSION: ${{ env.short_commit_hash }}
4349
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
4450
VERSION_NAME: ${{ github.event.release.name }}
4551
VERSION_IS_PRERELEASE: ${{ github.event.release.prerelease }}
@@ -50,10 +56,9 @@ jobs:
5056
with:
5157
files: build/libs/*.jar
5258

53-
5459
- name: Publish to Maven
5560
run: ./gradlew publishMavenPublicationToOffsetMonkey538Repository
5661
env:
62+
CUSTOM_VERSION: ${{ env.short_commit_hash }}
5763
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
5864
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
59-

Dockerfile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#FROM nginx:alpine AS runtime
2+
#COPY ./nginx.conf /etc/nginx/nginx.conf
3+
#COPY ./dist /usr/share/nginx/html
4+
#CMD ["nginx", "-g", "daemon off;"]
5+
6+
#FROM httpd:latest AS runtime
7+
#COPY ./dist /usr/local/apache2/htdocs/
8+
9+
FROM node:lts-slim AS base
10+
ENV PNPM_HOME="/pnpm"
11+
ENV PATH="$PATH:$PNPM_HOME"
12+
RUN corepack enable
13+
COPY /docs /docs
14+
WORKDIR /docs
15+
16+
FROM base AS build
17+
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
18+
RUN pnpm run build
19+
20+
FROM httpd:alpine
21+
COPY --from=build /docs/dist /usr/local/apache2/htdocs/
22+
EXPOSE 80
23+
24+
25+
#FROM base
26+
#COPY --from=prod-deps
27+
#COPY package.json pnpm-lock.yaml
28+
#RUN npm install -g pnpm
29+
30+
31+
32+
#FROM node:lts AS setup
33+
#WORKDIR /docs
34+
#COPY ./docs .
35+
#RUN npm install -g pnpm
36+
#RUN pnpm i
37+
#RUN pnpm run build
38+
39+
#FROM httpd:2.4 AS runtime
40+
#COPY --from=build /docs/dist /usr/local/apache2/htdocs/

README.md

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,25 @@
33
[![modrinth](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/available/modrinth_vector.svg)](https://modrinth.com/mod/loot-table-modifier)
44
[![Requires Fabric API](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/requires/fabric-api_vector.svg)](https://modrinth.com/mod/fabric-api)
55

6+
todo: good readme for alpha version
7+
8+
Allows datapacks to modify loot tables, instead of just overwriting them.
9+
Version 2 of the mod is currently in alpha. v2 adds more ways to modify loot tables than just adding to them
10+
v2 will be backwards-compatible with v1 modifiers, so no need to worry about them breaking.
11+
12+
If you want to use v1, then see the original description below.
13+
If you do decide to try out the alpha version of v2 (please do), then please go ahead and read the documentation [here](https://loot-table-modifier.docs.offsetmonkey538.top/) and if you encounter any problems, have suggestions for new actions/predicates or just want to say literally anything about the mod, please please please join my discord and tell me about it. I want to make this as good as I can and any sort of feedback really helps.
14+
15+
16+
17+
## Original Description
18+
619
Allows datapacks (and thus mods as well) to add to loot tables, instead of just overwriting them.
720

21+
This mod shouldn't impact performance while playing the game, but only when datapacks are reloading (joining a world, starting a server, `/reload` command, whatever else).
22+
Performance impact during pack reloading varies depending on the datapacks.
23+
The mod writes how long applying modifiers took in the console.
24+
825
Also provides a datagen provider for creating loot table modifiers in mods.
926

1027
A modifier json file includes two components:
@@ -65,21 +82,3 @@ dependencies {
6582
modImplementation "top.offsetmonkey538.loottablemodifier:loot-table-modifier:1.0.1+1.21.1"
6683
}
6784
```
68-
69-
## Badges
70-
###### No need to use them if you don't want to
71-
Badges are meant for developers to put on their project pages, so users can see that Loot Table Modifier is used or requires.
72-
They're based on [Devin's Badges](https://github.com/intergrav/devins-badges).
73-
74-
The `uses` badge is meant for mods or modpacks which want to display that Loot Table Modifier is included.
75-
It can be used in Markdown like this: `[![This project includes Loot Table Modifier](https://raw.githubusercontent.com/OffsetMods538/Loot-Table-Modifier/master/images/uses_badge.svg)](https://modrinth.com/mod/loot-table-modifier)`
76-
And will look like this:
77-
[![This project includes Loot Table Modifier](https://raw.githubusercontent.com/OffsetMods538/Loot-Table-Modifier/master/images/uses_badge.svg)](https://modrinth.com/mod/loot-table-modifier)
78-
Clicking it will bring the user to the Modrinth page for Loot Table Modifier
79-
80-
81-
The `requires` badge is meant for datapacks which want to display that Loot Table Modifier is required for the pack to function.
82-
It can be used in Markdown like this: `[![This project requires Loot Table Modifier to be installed](https://raw.githubusercontent.com/OffsetMods538/Loot-Table-Modifier/master/images/requires_badge.svg)](https://modrinth.com/mod/loot-table-modifier)`
83-
And will look like this:
84-
[![This project requires Loot Table Modifier to be installed](https://raw.githubusercontent.com/OffsetMods538/Loot-Table-Modifier/master/images/requires_badge.svg)](https://modrinth.com/mod/loot-table-modifier)
85-
Clicking it will bring the user to the Modrinth page for Loot Table Modifier

build.gradle

Lines changed: 41 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import dex.plugins.outlet.v2.util.ReleaseType
22

33
plugins {
4-
id 'fabric-loom' version '1.10-SNAPSHOT'
4+
id 'fabric-loom' version '1.11-SNAPSHOT'
55
id 'io.github.dexman545.outlet' version '1.6.1'
66
id 'com.modrinth.minotaur' version '2.+'
77
id 'maven-publish'
@@ -12,8 +12,21 @@ targetCompatibility = JavaVersion.VERSION_17
1212

1313
archivesBaseName = "loot-table-modifier"
1414
group = "top.offsetmonkey538.loottablemodifier"
15-
version = "${project.mod_version}+${project.minecraft_version}"
16-
if (System.getenv("IS_DEBUG") == "true") version = "${version}-${System.currentTimeMillis()}"
15+
16+
17+
version = project.mod_version
18+
19+
if ("true".equalsIgnoreCase(System.getenv("IS_DEBUG"))) {
20+
version = "${version}-${System.currentTimeMillis()}"
21+
}
22+
23+
final String customVersion = System.getenv("CUSTOM_VERSION")
24+
if (customVersion != null && !customVersion.isEmpty()) {
25+
version = "${version}-${customVersion}"
26+
}
27+
28+
version = "${project.version}+${project.minecraft_version}"
29+
println "Version: ${version}"
1730

1831
outlet {
1932
maintainPropertiesFile = System.getenv("DISABLE_PROPERTIES_UPDATE") == null
@@ -146,13 +159,12 @@ java {
146159
tasks.named("javadoc", Javadoc) {
147160
options.addFileOption('-add-stylesheet', project.file("javadoc-stylesheet.css"))
148161

149-
// Temporarily
150-
//options {
151-
// links(
152-
// "https://maven.fabricmc.net/docs/fabric-api-${project.fapi_version}/",
153-
// "https://maven.fabricmc.net/docs/yarn-${project.yarn_version}/"
154-
// )
155-
//}
162+
options {
163+
links(
164+
"https://maven.fabricmc.net/docs/fabric-api-${project.fapi_version}/",
165+
"https://maven.fabricmc.net/docs/yarn-${project.yarn_version}/"
166+
)
167+
}
156168
}
157169

158170
jar {
@@ -162,28 +174,43 @@ jar {
162174
}
163175

164176
modrinth {
177+
// Main properties
165178
token = System.getenv("MODRINTH_TOKEN")
166179
projectId = "loot-table-modifier"
180+
gameVersions = outlet.mcVersions()
181+
182+
// Version stuff
167183
def customVersionName = System.getenv("VERSION_NAME")
168184
if (customVersionName != null) versionName = customVersionName
185+
169186
versionNumber = "${project.version}"
170-
versionType = "alpha"
187+
171188
def isPreRelease = System.getenv("VERSION_IS_PRERELEASE")
172-
versionType = !"false".equals(isPreRelease) ? "beta" : "release"
189+
versionType = "true".equalsIgnoreCase(isPreRelease) ? "beta" : "release"
190+
191+
if (project.mod_version.contains("beta")) versionType = "beta"
192+
else if (project.mod_version.contains("alpha")) versionType = "alpha"
193+
194+
195+
// Files
173196
uploadFile = remapJar.archiveFile
174197
//additionalFiles = [sourcesJar.archiveFile, javadocJar.archiveFile]
175198
additionalFiles = [sourcesJar.archiveFile]
176-
gameVersions = outlet.mcVersions()
199+
200+
177201
syncBodyFrom = rootProject.file("README.md").text
178202
def changelogEnv = System.getenv("VERSION_CHANGELOG")
179203
if (changelogEnv != null) changelog = changelogEnv
180204

205+
181206
dependencies {
182207
required.project "fabric-api"
183208
}
184209
}
185210

186211
tasks.modrinth.dependsOn(tasks.modrinthSyncBody)
212+
213+
187214
publishing {
188215
repositories {
189216
maven {
@@ -205,10 +232,4 @@ publishing {
205232
from(components["java"])
206233
}
207234
}
208-
tasks.publishMavenPublicationToMavenLocal.doLast {
209-
if (System.getenv("IS_DEBUG") == "true") System.out.println("Version: " + version)
210-
}
211-
tasks.publishMavenPublicationToOffsetMonkey538Repository.doLast {
212-
if (System.getenv("IS_DEBUG") == "true") System.out.println("Version: " + version)
213-
}
214-
}
235+
}

docker-compose-template.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Hosts a static page
2+
services:
3+
${URL_PREFIX}loot-table-modifier:
4+
image: registry.oracle.offsetmonkey538.top/loot-table-modifier/docs:${SHORT_COMMIT_HASH}
5+
restart: unless-stopped
6+
networks:
7+
- traefik-proxy
8+
labels:
9+
- "traefik.enable=true"
10+
11+
- "traefik.http.routers.${URL_PREFIX}loot-table-modifier.rule=Host(`${URL_PREFIX}loot-table-modifier.docs.offsetmonkey538.top`)"
12+
- "traefik.http.routers.${URL_PREFIX}loot-table-modifier.service=${URL_PREFIX}loot-table-modifier"
13+
- "traefik.http.services.${URL_PREFIX}loot-table-modifier.loadbalancer.server.port=80"
14+
15+
networks:
16+
traefik-proxy:
17+
external: true

docs/.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# build output
2+
dist/
3+
# generated types
4+
.astro/
5+
6+
# dependencies
7+
node_modules/
8+
9+
# logs
10+
npm-debug.log*
11+
yarn-debug.log*
12+
yarn-error.log*
13+
pnpm-debug.log*
14+
15+
16+
# environment variables
17+
.env
18+
.env.production
19+
20+
# macOS-specific files
21+
.DS_Store

docs/.vscode/extensions.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"recommendations": ["astro-build.astro-vscode"],
3+
"unwantedRecommendations": []
4+
}

docs/.vscode/launch.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"command": "./node_modules/.bin/astro dev",
6+
"name": "Development server",
7+
"request": "launch",
8+
"type": "node-terminal"
9+
}
10+
]
11+
}

0 commit comments

Comments
 (0)