Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
29 changes: 29 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
tab_width = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.gradle.kts]
indent_style = tab

[*.java]
indent_style = tab

[*.json]
indent_style = space
indent_size = 2

[fabric.mod.json]
indent_style = tab
tab_width = 2

[*.properties]
indent_style = space
indent_size = 2
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: checkout repository
uses: actions/checkout@v6
- name: validate gradle wrapper
uses: gradle/actions/wrapper-validation@v6
uses: gradle/actions/wrapper-validation@v5
- name: setup jdk ${{ matrix.java }}
uses: actions/setup-java@v5
with:
Expand All @@ -35,7 +35,7 @@ jobs:
run: ./gradlew build
- name: capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '21' }} # Only upload artifacts built from latest java on one OS
uses: actions/upload-artifact@v7
uses: actions/upload-artifact@v6
with:
name: Artifacts
path: build/libs/
40 changes: 36 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,39 @@
# BTWaila
Add custom tooltips for Blocks, TileEntities and Mobs from minecraft and other mods.
# Example Mod

Template for making Babric mods for BTA!

Mod integration is a thing but i don't know how you can implement it, i'll update the Read.me with detailed information when done!
**Note: *DO NOT fork this repository unless you want to contribute!***

## Prerequisites
- JDK for Java 21 ([Eclipse Temurin](https://adoptium.net/temurin/releases/) recommended)
- [Intellij IDEA](https://www.jetbrains.com/idea/download/) (Scroll down for the free community edition, if using linux **DO NOT** use the flatpak distribution)
- Minecraft Development plugin (Optional, but highly recommended)

## Setup instructions


1. Click the `Use this template` button on this repo's page above (Will only appear if logged in). Choose `Create a new repository`, you will be redirected to a new page. Enter your repo's name and description, and hit `Create repository`.
To get your project, open IntelliJ IDEA and click `Clone Repository` (`Get from VCS` on older versions). Select `Repository URL` and enter your repo's url

2. After the project has finished importing, close it and open it again.
If that does not work, open the right sidebar with `Gradle` on it, open `Tasks` > `fabric` and run `ideaSyncTask`.

3. Create a new run configuration by going in `Run > Edit Configurations`.
Then click on the plus icon and select Gradle. In the `Tasks and Arguments` field enter `build`.
Running it will build your finished jar files and put them in `build/libs/`.

4. Lastly, open `File` > `Settings` and head to `Build, Execution, Development` > `Build Tools` > `Gradle`.
Make sure `Build and run using` and `Run tests using` is set to `Gradle`.

5. Done! Now, all that's left is to change every mention of `examplemod` and `turniplabs` to your own mod id and mod group, respectively. Happy modding!

## Tips

1. If you haven't already you should join the BTA modding discord! https://discord.gg/FTUNJhswBT
2. You can set your username when launching the client run configuration by setting `--username <username>` in your program arguments.
3. When launching the server run configuration you may want to remove the `nogui` program argument in order to see the regular server GUI.
4. In Intellij you can double press shift or press ctrl+N to search class files, change the search from the default `Project Files` to `All Places` you can easily explore the classes for your dependencies and even BTA itself.
5. In Intellij if ctrl+left-click on a field or method you can quickly get information on when and where that field or method is assign or used.
6. Ensure IntelliJ is updated to the latest version. This is important because this template uses the latest Gradle version and if your IntelliJ installation is outdated, it may not support the latest version.
7. In the `examplemod.mixins.json` you'll see `"compatibilityLevel": "JAVA_${java}",` along with an error message from the `Minecraft Development` plugin stating `Cannot resolve compatibility level 'JAVA_${java}'`. You can safely ignore this. The Gradle build system has been set up to grab the Java version from your `gradle.properties` and replace `${java}` with it. So the compiled binary will properly have it as `JAVA_8`.

Next update will contain code made by UselessBullets. he is now a contributor, thanks to him 1.0.0 will be out sooner
124 changes: 25 additions & 99 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import com.google.gson.Gson
import com.smushytaco.lwjgl_gradle.Preset
plugins {
alias(libs.plugins.loom)
alias(libs.plugins.lwjgl)
java
`maven-publish`
java
}
val modVersion: Provider<String> = providers.gradleProperty("mod_version")
val modGroup: Provider<String> = providers.gradleProperty("mod_group")
Expand All @@ -15,90 +13,38 @@ val javaVersion: Provider<Int> = libs.versions.java.map { it.toInt() }
base.archivesName = modName
group = modGroup.get()
version = modVersion.get()

class AccountsJson(val accounts: List<Account>)
class Account(val profile: Profile, val ygg: YGG)
class YGG(val token: String)
class Profile(val name: String, val id: String)

val prismAccountsFile = providers.provider {
val explicit = providers.gradleProperty("prism.accounts.file").orNull
if (explicit != null) {
val explicitFile = File(explicit)
if (explicitFile.exists()) return@provider explicitFile
}

val home = System.getProperty("user.home")

val candidates = buildList {
// Windows
System.getenv("APPDATA")?.let { add(File(it, "PrismLauncher/accounts.json")) }
System.getenv("HOMEPATH")?.let { add(File(it, "scoop/persist/prismlauncher/accounts.json")) }
// Linux / XDG
val xdgDataHome = System.getenv("XDG_DATA_HOME")
if (xdgDataHome != null) {
add(File(xdgDataHome, "PrismLauncher/accounts.json"))
} else {
add(File(home, ".local/share/PrismLauncher/accounts.json"))
}
// Flatpak
add(File(home, ".var/app/org.prismlauncher.PrismLauncher/data/PrismLauncher/accounts.json"))
// macOS
add(File(home, "Library/Application Support/PrismLauncher/accounts.json"))
}
candidates.firstOrNull(File::exists)
}

loom {
customMinecraftMetadata.set("https://downloads.betterthanadventure.net/bta-client/${libs.versions.btaChannel.get()}/v${libs.versions.bta.get()}/manifest.json")
runs {
prismAccountsFile.orNull?.let { file ->
val account: Provider<Account> = providers.fileContents(layout.file(providers.provider { file }))
.asText
.map { jsonStr ->
val accountNumber = (providers.gradleProperty("prism.accounts.number").orNull?.toInt() ?: 1) - 1
val accounts = Gson().fromJson(jsonStr, AccountsJson::class.java).accounts
accounts.getOrNull(accountNumber.coerceIn(0, accounts.size - 1))
?: error("No PrismLauncher accounts found in ${file.absolutePath}")
}
register("clientAuth") {
inherit(getByName("client"))
configName = "Minecraft Client (Auth)"
val acc = account.get()
programArgs("--username", acc.profile.name, "--uuid", acc.profile.id, "--session", acc.ygg.token)
}
}
}
customMinecraftMetadata.set("https://downloads.betterthanadventure.net/bta-client/${libs.versions.btaChannel.get()}/${libs.versions.bta.get()}/manifest.json")
}

repositories {
mavenCentral()
maven("https://maven.fabricmc.net/") { name = "Fabric" }
maven("https://maven.thesignalumproject.net/infrastructure") { name = "SignalumMavenInfrastructure" }
maven("https://maven.thesignalumproject.net/releases") { name = "SignalumMavenReleases" }
ivy("https://github.com/Better-than-Adventure") {
patternLayout { artifact("[organisation]/releases/download/[revision]/[module]-bta-[revision].jar") }
metadataSources { artifact() }
}
ivy("https://downloads.betterthanadventure.net/bta-client/${libs.versions.btaChannel.get()}/") {
patternLayout { artifact("/v[revision]/client.jar") }
metadataSources { artifact() }
}
ivy("https://downloads.betterthanadventure.net/bta-server/${libs.versions.btaChannel.get()}/") {
patternLayout { artifact("/v[revision]/server.jar") }
metadataSources { artifact() }
}
ivy("https://piston-data.mojang.com") {
patternLayout { artifact("v1/[organisation]/[revision]/[module].jar") }
metadataSources { artifact() }
}
mavenCentral()
maven("https://maven.fabricmc.net/") { name = "Fabric" }
maven("https://maven.thesignalumproject.net/infrastructure") { name = "SignalumMavenInfrastructure" }
maven("https://maven.thesignalumproject.net/releases") { name = "SignalumMavenReleases" }
maven("https://maven.thesignalumproject.net/nightly") { name = "SignalumMavenNightly" }
ivy("https://github.com/Better-than-Adventure") {
patternLayout { artifact("[organisation]/releases/download/[revision]/[module]-bta-[revision].jar") }
metadataSources { artifact() }
}
ivy("https://downloads.betterthanadventure.net/bta-client/${libs.versions.btaChannel.get()}/") {
patternLayout { artifact("/v[revision]/client.jar") }
metadataSources { artifact() }
}
ivy("https://downloads.betterthanadventure.net/bta-server/${libs.versions.btaChannel.get()}/") {
patternLayout { artifact("/v[revision]/server.jar") }
metadataSources { artifact() }
}
ivy("https://piston-data.mojang.com") {
patternLayout { artifact("v1/[organisation]/[revision]/[module].jar") }
metadataSources { artifact() }
}
}
lwjgl {
version = libs.versions.lwjgl
implementation(Preset.MINIMAL_OPENGL)
}
dependencies {
minecraft("::${libs.versions.bta.get()}")
minecraft("::${libs.versions.bta.get()}")

runtimeOnly(libs.clientJar)
implementation(libs.loader)
Expand Down Expand Up @@ -152,7 +98,7 @@ tasks {
targetCompatibility = javaVersion.get().toString()
if (javaVersion.get() > 8) options.release = javaVersion
}
withType<UpdateDaemonJvm>().configureEach {
named<UpdateDaemonJvm>("updateDaemonJvm") {
languageVersion = libs.versions.gradleJava.map { JavaLanguageVersion.of(it.toInt()) }
vendor = JvmVendorSpec.ADOPTIUM
}
Expand Down Expand Up @@ -181,23 +127,3 @@ tasks {
}
// Removes LWJGL2 dependencies
configurations.configureEach { exclude(group = "org.lwjgl.lwjgl") }

publishing {
repositories {
maven("https://maven.thesignalumproject.net/releases") {
name = "signalumMaven"
credentials(PasswordCredentials::class)
authentication {
create<BasicAuthentication>("basic")
}
}
}
publications {
create<MavenPublication>("maven") {
groupId = modGroup.get()
artifactId = modName.get()
version = modVersion.get()
from(components["java"])
}
}
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ org.gradle.warning.mode = all
org.gradle.configuration-cache = false
##########################################################################
# Mod Properties
mod_version = 1.2.5-7.3_04
mod_version = 1.3.0
mod_group = useless
mod_name = btwaila
##########################################################################
Expand Down
16 changes: 8 additions & 8 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ lwjglPlugin = "1.0.2"
##########################################################################
# Java Configuration
# The Java version the JDK will be for compiling and running code.
java = "8"
java = "17"
# The Java version the JDK will be for running Gradle.
gradleJava = "21"
##########################################################################
# Mod Dependencies
# Check this on https://downloads.betterthanadventure.net/bta-client/
bta = "7.3_04"
bta = "v8.0-pre1"
# Options are release, prerelease, nightly, and misc.
btaChannel = "release"
btaChannel = "prerelease"
# Check this on https://maven.thesignalumproject.net/#/infrastructure/net/fabricmc/fabric-loader/
loader = "0.18.4-bta.10"
loader = "0.18.4-bta.11"
# Check this on https://github.com/Turnip-Labs/ModMenu/releases/latest/
modMenu = "4.0.1"
modMenu = "5.0.0"
# Check this on https://github.com/Turnip-Labs/bta-halplibe/releases/latest/
halplibe = "5.4.1"
# Check this on https://maven.thesignalumproject.net/#/infrastructure/com/github/Better-than-Adventure/legacy-lwjgl3/
halplibe = "6.0.1"
# Check this on https://github.com/Better-than-Adventure/legacy-lwjgl3/releases/latest/
legacyLwjgl = "1.0.6"
##########################################################################
# Dependencies
Expand All @@ -45,7 +45,7 @@ lwjgl = "3.3.3"
loader = { group = "net.fabricmc", name = "fabric-loader", version.ref = "loader" }
halplibe = { group = "turniplabs", name = "halplibe", version.ref = "halplibe" }
modMenu = { group = "turniplabs", name = "modmenu-bta", version.ref = "modMenu" }
legacyLwjgl = { group = "com.github.Better-than-Adventure", name = "legacy-lwjgl3", version.ref = "legacyLwjgl" }
legacyLwjgl = { group = "legacy-lwjgl3", name = "legacy-lwjgl3", version.ref = "legacyLwjgl" }
slf4jApi = { group = "org.slf4j", name = "slf4j-api", version.ref = "slf4jApi" }
guava = { group = "com.google.guava", name = "guava", version.ref = "guava" }
log4j-slf4j2-impl = { group = "org.apache.logging.log4j", name = "log4j-slf4j2-impl", version.ref = "log4j" }
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Check this on https://gradle.org/releases/
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion gradlew

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/main/java/toufoumaster/btwaila/BTWaila.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
import toufoumaster.btwaila.network.packet.PacketRequestEntityData;
import toufoumaster.btwaila.network.packet.PacketRequestTileEntityData;
import toufoumaster.btwaila.util.VersionHelper;
import turniplabs.halplibe.HalpLibe;
import turniplabs.halplibe.util.GameStartEntrypoint;

import java.util.HashMap;
import java.util.Map;


public class BTWaila implements GameStartEntrypoint, ModInitializer {
public static final String MOD_ID = "btwaila";
public static final String MOD_ID = HalpLibe.registerMod("btwaila", true);
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
public static I18n translator = null;
public static boolean canUseAdvancedTooltips = false;
Expand Down
Loading
Loading