Skip to content

Version 2 Alpha 1 #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 55 commits into from
Jul 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
e4722f5
Add AddPoolAction
OffsetMonkey538 May 6, 2025
b9ee027
Implement loading and applying NewLootModifier, remove usages of orig…
OffsetMonkey538 May 6, 2025
97d677a
Make NewLootModifier compatible with old format (the one with just 'p…
OffsetMonkey538 May 6, 2025
13f4e96
Remove original LootModifier
OffsetMonkey538 May 6, 2025
48b4d93
Rename NewLootModifier to LootModifier
OffsetMonkey538 May 6, 2025
bb7fdc0
Cleanup
OffsetMonkey538 May 6, 2025
5ed8e2c
Allow regex for matching loot table, allow matching loot table by type
OffsetMonkey538 May 6, 2025
2c9ab5f
Allow matching loot table by function type
OffsetMonkey538 May 6, 2025
51ba7e0
Merge branch 'master' into 2-allow-more-operations-than-just-adding-p…
OffsetMonkey538 Jun 1, 2025
2e5f8e8
Lots of broken stuff
OffsetMonkey538 Jun 12, 2025
f9b98e6
Add SetItemAction and ItemEntryPredicate
OffsetMonkey538 Jun 12, 2025
dd8d04b
Correctly keep track of how many loot tables, pools and entries have …
OffsetMonkey538 Jun 12, 2025
de23bc1
Add loot table predicate
OffsetMonkey538 Jun 12, 2025
e203e3a
Add OptionalPattern
OffsetMonkey538 Jun 13, 2025
db4271d
Add overloads for 'ItemEntryPredicate.builder()' take take identifier…
OffsetMonkey538 Jun 13, 2025
9c8f78c
Use 'OptionalPattern#matches' instead of 'OptionalPattern#matcher'
OffsetMonkey538 Jun 13, 2025
dc0a8bb
Fix modifiers being applied multiple times when target table has mult…
OffsetMonkey538 Jun 13, 2025
7becdc0
Use same json writing logic as vanilla (ordering, etc) and export mod…
OffsetMonkey538 Jun 13, 2025
11c3fbe
Allow empty tables to be modified
OffsetMonkey538 Jun 13, 2025
d586a81
Remove New datagen provider, rename NewNew provider
OffsetMonkey538 Jun 13, 2025
0ecdb8d
apply method javadoc
OffsetMonkey538 Jun 13, 2025
4bda3d8
Add command for exporting loot tables instead of trying to do it auto…
OffsetMonkey538 Jun 13, 2025
dc9ec6e
Add remove_pool action
OffsetMonkey538 Jun 13, 2025
cc1e8fa
Force object version of OptionalPattern to always use regex
OffsetMonkey538 Jun 16, 2025
f126d2f
Update fapi
OffsetMonkey538 Jun 16, 2025
17f4058
Refactoring
OffsetMonkey538 Jun 19, 2025
113d7c0
Add AddEntryAction
OffsetMonkey538 Jun 19, 2025
85304b2
Rename debug export dir
OffsetMonkey538 Jun 19, 2025
11dc15a
Rename action and predicate types
OffsetMonkey538 Jun 19, 2025
2ca2850
Merge branch 'master' into 2-allow-more-operations-than-just-adding-p…
OffsetMonkey538 Jul 7, 2025
8fe96b0
Update gradle to v8.14.3
OffsetMonkey538 Jul 7, 2025
0a04879
Update loom to v1.11
OffsetMonkey538 Jul 7, 2025
e5abbbd
Include commit hash in builds
OffsetMonkey538 Jul 7, 2025
3208011
Fix ids without namespaces not being matched.
OffsetMonkey538 Jul 7, 2025
2009a70
Add remove entry action
OffsetMonkey538 Jul 7, 2025
a8b82c3
Fix multiple entries/pools not being able to be removed from the same…
OffsetMonkey538 Jul 7, 2025
0f93277
Example datagen for testing RemoveEntry
OffsetMonkey538 Jul 7, 2025
61539e0
Make codecs only accept a list when possible
OffsetMonkey538 Jul 7, 2025
ca796f8
Fix loading of legacy modifiers
OffsetMonkey538 Jul 7, 2025
e3a6c86
Make loot modifier store only a single predicate instead of a list
OffsetMonkey538 Jul 7, 2025
8f41831
Implement legacy codec more efficiently
OffsetMonkey538 Jul 7, 2025
e7775bf
Fix loot table predicate sometimes not matching tables when it should
OffsetMonkey538 Jul 7, 2025
7494ae2
Make loot modifier only accept a list of actions
OffsetMonkey538 Jul 7, 2025
9e8ca3a
javadoc :D
OffsetMonkey538 Jul 20, 2025
d1cb9e3
Rename OptionalIdentifierPattern to RegexPattern
OffsetMonkey538 Jul 20, 2025
4d47607
Cleanup
OffsetMonkey538 Jul 20, 2025
4fd3cae
Rename things to match their registered ids
OffsetMonkey538 Jul 20, 2025
572f4de
Cleanup
OffsetMonkey538 Jul 20, 2025
cc2c8e1
Add docs (#4)
OffsetMonkey538 Jul 20, 2025
6f4400d
Fix borked example
OffsetMonkey538 Jul 20, 2025
83ea588
Build on 1.21.8 and set supported version for this alpha
OffsetMonkey538 Jul 20, 2025
c9e025a
Use current codec on left side of either. Errors are now actually inf…
OffsetMonkey538 Jul 20, 2025
694ecde
readme
OffsetMonkey538 Jul 20, 2025
4e4c5ca
Publish docs as a separate workflow
OffsetMonkey538 Jul 20, 2025
22ce48c
pushes should go to staging
OffsetMonkey538 Jul 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/workflows/build_artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,28 @@ jobs:
with:
cache-read-only: false

- name: Store short commit hash
run: echo "short_commit_hash=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"

- name: Generate resources with Gradle
run: ./gradlew runDatagenClient
env:
CUSTOM_VERSION: ${{ env.short_commit_hash }}
DISABLE_PROPERTIES_UPDATE: true


- name: Build with Gradle
run: ./gradlew build
env:
CUSTOM_VERSION: ${{ env.short_commit_hash }}
DISABLE_PROPERTIES_UPDATE: true

- name: Publish to Maven
run: ./gradlew publishMavenPublicationToOffsetMonkey538Repository
env:
CUSTOM_VERSION: ${{ env.short_commit_hash }}
DISABLE_PROPERTIES_UPDATE: true
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}

- name: Upload build artifacts
uses: actions/upload-artifact@v4
Expand Down
58 changes: 58 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Publish docs

on:
push:
branches:
- "*"
release:
types: [published]


jobs:
publish-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set url prefix
run: |
if [[ "${{ github.event_name }}" == "push" || "${{ github.event.release.prerelease }}" == "true" ]]; then
echo "url_prefix=staging-" >> "$GITHUB_ENV"
else
echo "url_prefix=" >> "$GITHUB_ENV"
fi

- name: Store short commit hash
run: echo "short_commit_hash=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"

- uses: danielr1996/envsubst-action@1.1.0
env:
URL_PREFIX: ${{ env.url_prefix }}
SHORT_COMMIT_HASH: ${{ env.short_commit_hash }}
with:
input: docker-compose-template.yml
output: docker-compose.yml

- name: Login to container registry
uses: docker/login-action@v3
with:
registry: registry.oracle.offsetmonkey538.top
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: registry.oracle.offsetmonkey538.top/loot-table-modifier/docs:${{ env.short_commit_hash }}

- run: |
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
env:
SEELF_TOKEN: ${{ secrets.SEELF_TOKEN }}
SEELF_ENVIRONMENT: staging
SEELF_APPLICATION_URL: https://seelf.oracle.offsetmonkey538.top/api/v1/apps/300qBnG3t1dOFrUGfw1EeWYwKYA/deployments
9 changes: 7 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,26 @@ jobs:
with:
cache-read-only: false

- name: Store short commit hash
run: echo "short_commit_hash=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"

- name: Generate resources with Gradle
run: ./gradlew runDatagenClient
env:
CUSTOM_VERSION: ${{ env.short_commit_hash }}
DISABLE_PROPERTIES_UPDATE: true


- name: Build with Gradle
run: ./gradlew build
env:
CUSTOM_VERSION: ${{ env.short_commit_hash }}
DISABLE_PROPERTIES_UPDATE: true

- name: Upload to Modrinth
run: ./gradlew modrinth
env:
CUSTOM_VERSION: ${{ env.short_commit_hash }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
VERSION_NAME: ${{ github.event.release.name }}
VERSION_IS_PRERELEASE: ${{ github.event.release.prerelease }}
Expand All @@ -50,10 +56,9 @@ jobs:
with:
files: build/libs/*.jar


- name: Publish to Maven
run: ./gradlew publishMavenPublicationToOffsetMonkey538Repository
env:
CUSTOM_VERSION: ${{ env.short_commit_hash }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}

40 changes: 40 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#FROM nginx:alpine AS runtime
#COPY ./nginx.conf /etc/nginx/nginx.conf
#COPY ./dist /usr/share/nginx/html
#CMD ["nginx", "-g", "daemon off;"]

#FROM httpd:latest AS runtime
#COPY ./dist /usr/local/apache2/htdocs/

FROM node:lts-slim AS base
ENV PNPM_HOME="/pnpm"
ENV PATH="$PATH:$PNPM_HOME"
RUN corepack enable
COPY /docs /docs
WORKDIR /docs

FROM base AS build
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
RUN pnpm run build

FROM httpd:alpine
COPY --from=build /docs/dist /usr/local/apache2/htdocs/
EXPOSE 80


#FROM base
#COPY --from=prod-deps
#COPY package.json pnpm-lock.yaml
#RUN npm install -g pnpm



#FROM node:lts AS setup
#WORKDIR /docs
#COPY ./docs .
#RUN npm install -g pnpm
#RUN pnpm i
#RUN pnpm run build

#FROM httpd:2.4 AS runtime
#COPY --from=build /docs/dist /usr/local/apache2/htdocs/
35 changes: 17 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,25 @@
[![modrinth](https://cdn.jsdelivr.net/npm/@intergrav/devins-badges@3/assets/cozy/available/modrinth_vector.svg)](https://modrinth.com/mod/loot-table-modifier)
[![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)

todo: good readme for alpha version

Allows datapacks to modify loot tables, instead of just overwriting them.
Version 2 of the mod is currently in alpha. v2 adds more ways to modify loot tables than just adding to them
v2 will be backwards-compatible with v1 modifiers, so no need to worry about them breaking.

If you want to use v1, then see the original description below.
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.



## Original Description

Allows datapacks (and thus mods as well) to add to loot tables, instead of just overwriting them.

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).
Performance impact during pack reloading varies depending on the datapacks.
The mod writes how long applying modifiers took in the console.

Also provides a datagen provider for creating loot table modifiers in mods.

A modifier json file includes two components:
Expand Down Expand Up @@ -65,21 +82,3 @@ dependencies {
modImplementation "top.offsetmonkey538.loottablemodifier:loot-table-modifier:1.0.1+1.21.1"
}
```

## Badges
###### No need to use them if you don't want to
Badges are meant for developers to put on their project pages, so users can see that Loot Table Modifier is used or requires.
They're based on [Devin's Badges](https://github.com/intergrav/devins-badges).

The `uses` badge is meant for mods or modpacks which want to display that Loot Table Modifier is included.
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)`
And will look 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)
Clicking it will bring the user to the Modrinth page for Loot Table Modifier


The `requires` badge is meant for datapacks which want to display that Loot Table Modifier is required for the pack to function.
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)`
And will look 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)
Clicking it will bring the user to the Modrinth page for Loot Table Modifier
61 changes: 41 additions & 20 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import dex.plugins.outlet.v2.util.ReleaseType

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

archivesBaseName = "loot-table-modifier"
group = "top.offsetmonkey538.loottablemodifier"
version = "${project.mod_version}+${project.minecraft_version}"
if (System.getenv("IS_DEBUG") == "true") version = "${version}-${System.currentTimeMillis()}"


version = project.mod_version

if ("true".equalsIgnoreCase(System.getenv("IS_DEBUG"))) {
version = "${version}-${System.currentTimeMillis()}"
}

final String customVersion = System.getenv("CUSTOM_VERSION")
if (customVersion != null && !customVersion.isEmpty()) {
version = "${version}-${customVersion}"
}

version = "${project.version}+${project.minecraft_version}"
println "Version: ${version}"

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

// Temporarily
//options {
// links(
// "https://maven.fabricmc.net/docs/fabric-api-${project.fapi_version}/",
// "https://maven.fabricmc.net/docs/yarn-${project.yarn_version}/"
// )
//}
options {
links(
"https://maven.fabricmc.net/docs/fabric-api-${project.fapi_version}/",
"https://maven.fabricmc.net/docs/yarn-${project.yarn_version}/"
)
}
}

jar {
Expand All @@ -162,28 +174,43 @@ jar {
}

modrinth {
// Main properties
token = System.getenv("MODRINTH_TOKEN")
projectId = "loot-table-modifier"
gameVersions = outlet.mcVersions()

// Version stuff
def customVersionName = System.getenv("VERSION_NAME")
if (customVersionName != null) versionName = customVersionName

versionNumber = "${project.version}"
versionType = "alpha"

def isPreRelease = System.getenv("VERSION_IS_PRERELEASE")
versionType = !"false".equals(isPreRelease) ? "beta" : "release"
versionType = "true".equalsIgnoreCase(isPreRelease) ? "beta" : "release"

if (project.mod_version.contains("beta")) versionType = "beta"
else if (project.mod_version.contains("alpha")) versionType = "alpha"


// Files
uploadFile = remapJar.archiveFile
//additionalFiles = [sourcesJar.archiveFile, javadocJar.archiveFile]
additionalFiles = [sourcesJar.archiveFile]
gameVersions = outlet.mcVersions()


syncBodyFrom = rootProject.file("README.md").text
def changelogEnv = System.getenv("VERSION_CHANGELOG")
if (changelogEnv != null) changelog = changelogEnv


dependencies {
required.project "fabric-api"
}
}

tasks.modrinth.dependsOn(tasks.modrinthSyncBody)


publishing {
repositories {
maven {
Expand All @@ -205,10 +232,4 @@ publishing {
from(components["java"])
}
}
tasks.publishMavenPublicationToMavenLocal.doLast {
if (System.getenv("IS_DEBUG") == "true") System.out.println("Version: " + version)
}
tasks.publishMavenPublicationToOffsetMonkey538Repository.doLast {
if (System.getenv("IS_DEBUG") == "true") System.out.println("Version: " + version)
}
}
}
17 changes: 17 additions & 0 deletions docker-compose-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Hosts a static page
services:
${URL_PREFIX}loot-table-modifier:
image: registry.oracle.offsetmonkey538.top/loot-table-modifier/docs:${SHORT_COMMIT_HASH}
restart: unless-stopped
networks:
- traefik-proxy
labels:
- "traefik.enable=true"

- "traefik.http.routers.${URL_PREFIX}loot-table-modifier.rule=Host(`${URL_PREFIX}loot-table-modifier.docs.offsetmonkey538.top`)"
- "traefik.http.routers.${URL_PREFIX}loot-table-modifier.service=${URL_PREFIX}loot-table-modifier"
- "traefik.http.services.${URL_PREFIX}loot-table-modifier.loadbalancer.server.port=80"

networks:
traefik-proxy:
external: true
21 changes: 21 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# build output
dist/
# generated types
.astro/

# dependencies
node_modules/

# logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*


# environment variables
.env
.env.production

# macOS-specific files
.DS_Store
4 changes: 4 additions & 0 deletions docs/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"recommendations": ["astro-build.astro-vscode"],
"unwantedRecommendations": []
}
11 changes: 11 additions & 0 deletions docs/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "./node_modules/.bin/astro dev",
"name": "Development server",
"request": "launch",
"type": "node-terminal"
}
]
}
Loading