No description
Find a file
2026-11-18 23:41:10 -05:00
common multiloader stuff 2026-11-18 23:41:10 -05:00
gradle multiloader stuff 2026-11-18 23:41:10 -05:00
loaders multiloader stuff 2026-11-18 23:41:10 -05:00
packs multiloader stuff 2026-11-18 23:41:10 -05:00
targets multiloader stuff 2026-11-18 23:41:10 -05:00
.gitignore multiloader stuff 2026-11-18 23:41:10 -05:00
build.gradle multiloader stuff 2026-11-18 23:41:10 -05:00
gradle.properties multiloader stuff 2026-11-18 23:41:10 -05:00
gradlew Initial commit, woo 2021-07-26 19:39:00 -04:00
gradlew.bat Initial commit, woo 2021-07-26 19:39:00 -04:00
LICENSE Size shrinkage 2021-12-21 16:22:50 -05:00
README.md multiloader stuff 2026-11-18 23:41:10 -05:00
settings.gradle multiloader stuff 2026-11-18 23:41:10 -05:00

ServShred

Simple server side vein miner mod.

One codebase, built for several Minecraft versions on several mod loaders.

Minecraft Fabric Forge NeoForge Java
1.20.1 yes yes 17
1.21.1 yes yes 21
1.21.11 yes yes 21
26.1.x yes yes 25
26.2 yes yes 25

The 26.1 jars are built against 26.1.2 and declare compatibility with all of 26.1.x.

Building

./gradlew collectJars                  # every target
./gradlew :1.21.1-neoforge:build       # a single target
./gradlew :26.2-fabric:runServer       # dev server for a single target
./gradlew clean                        # also empties dist/

Finished jars are copied into the dist/ folder in the root of the repo after every build, named servshred-<loader>-<modversion>+mc<minecraft>.jar, for example dist/servshred-neoforge-1.0.14+mc1.21.1.jar.

Gradle downloads the JDK each target needs (17, 21 or 25) through toolchains, so only a JDK that can run Gradle 9.6 has to be installed.

Layout

common/src/main/java          the mod itself, identical for every target
common/compat/<name>/java     tiny shims for APIs Minecraft renamed (ResourceLocation -> Identifier)
common/data/<layout>/         the vein-mine block tag: "plural" (<= 1.20.x) or "singular" (>= 1.21)
common/resources/             icon
loaders/<loader>/             the entrypoint and metadata file for Fabric, Forge or NeoForge
loaders/neoforge26/           NeoForge 26.1.2+ entrypoint (BreakBlockEvent), picked with loader_sources=
packs/                        pack.mcmeta files for the loaders that want one
targets/<minecraft>-<loader>/ one folder per build, just a gradle.properties
gradle/target.gradle          the build logic every target shares
dist/                         finished jars (created by the build, not committed)

Every target compiles the shared code against its own Minecraft version, using Mojang's names on all loaders. Nothing is shared at the jar level.

Adding a Minecraft version

  1. Copy the closest folder in targets/ and rename it (<minecraft>-<loader>).
  2. Update the versions in its gradle.properties.
  3. If that Minecraft version spells something differently, add a folder under common/compat/ and point compat= at it.

Settings in gradle.properties for a target:

Key Meaning
loader fabric, neoforge or forge
compat folder in common/compat
data_layout plural or singular
java_version JDK the target compiles and runs on
fabric_remap Fabric only: true up to 1.21.11 (obfuscated), false from 26.1
minecraft_range, loader_range, platform_range version ranges written into the metadata file
pack_resources optional folder holding a pack.mcmeta

Config

config/servshred.properties is created on first start and documents every option. The old Fabric-only config file is not read, so settings need to be copied over once.

Behavior notes

  • Fabric is told about a break after it happened. Forge and NeoForge only have a "before break" event, so vein mining is queued from it and the first tick checks the origin block really did break before it starts.
  • Vein mining runs once per server tick for every active vein, rather than once per dimension tick.
  • Dropped items and XP orbs are moved with setPos instead of snapTo, because that call is named differently in older versions.

Not yet built

This project was written without access to the Gradle plugin and loader repositories, so it has never been compiled. Things most likely to need a tweak on the first build:

  • Version numbers in targets/*/gradle.properties, especially Forge 47.4.0 and Fabric API 0.92.11+1.20.1 (any newer build is fine).
  • Player#hurt in ServShred.afterMine on 1.21.11 and 26.x. The original mod calls it on 26.2, but if the compiler wants hurtServer(level, source, amount) it is a one-line change there.
  • The addListener(EventPriority, boolean, Class, Consumer) overload on the NeoForge 26.x event bus. If it changed, register the break listener with @SubscribeEvent(priority = LOWEST).
  • pack.mcmeta for NeoForge 1.21.11 and 26.x is omitted. If the vein-mine tag does not load there, add one under packs/ and point pack_resources at it.
  • Loom and ModDevGradle sharing one Gradle build. If plugin classpath clashes appear, move each loader into its own build and keep common/ and loaders/ as they are.

License

MPL-2.0, see LICENSE.