Skip to content
Open
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
71 changes: 39 additions & 32 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
plugins {
id 'fabric-loom' version "${loom_version}"
id 'net.fabricmc.fabric-loom' version "${loom_version}"
id 'maven-publish'
id 'io.freefair.lombok' version '8.10'
id 'io.freefair.lombok' version '9.5.0'
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
toolchain {
languageVersion = JavaLanguageVersion.of(25)
}
sourceCompatibility = JavaVersion.VERSION_25
targetCompatibility = JavaVersion.VERSION_25
}

lombok {
version = project.lombok_version
}

version = "${project.minecraft_version}-${project.mod_version}"
Expand All @@ -23,41 +27,46 @@ if (file("extra.properties").exists()) {
repositories {
mavenCentral()
maven { url 'https://masa.dy.fi/maven' }
maven { url 'https://masa.dy.fi/maven/sakura-ryoko' }
maven { url 'https://maven.terraformersmc.com/releases/' }
maven { url 'https://jitpack.io' }
maven { url 'https://maven.wispforest.io' }
maven { url 'https://maven.fallenbreath.me/releases' }
maven { url 'https://maven.fallenbreath.me/releases' }
maven { url 'https://api.modrinth.com/maven' }
}

dependencies {
// No `mappings` line: 26.2 is distributed unobfuscated, so Loom uses the
// official names directly. For the same reason mod dependencies are declared
// with the plain configurations rather than `modImplementation` — the `mod*`
// ones invoke Loom's remapper, which then demands a mappings dependency that
// no longer exists for this Minecraft version.
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"
modImplementation "com.github.sakura-ryoko:malilib:${project.malilib_version}"
modCompileOnly "com.terraformersmc:modmenu:${project.modmenu_version}"
implementation "net.fabricmc:fabric-loader:${project.loader_version}"
implementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"
implementation "maven.modrinth:malilib:${project.malilib_version}"
compileOnly "com.terraformersmc:modmenu:${project.modmenu_version}"

implementation "com.github.DarkKronicle.Konstruct:addons:${project.konstruct_version}"
implementation "com.github.DarkKronicle.Konstruct:core:${project.konstruct_version}"
include "com.github.DarkKronicle.Konstruct:addons:${project.konstruct_version}"
include "com.github.DarkKronicle.Konstruct:core:${project.konstruct_version}"

implementation 'com.electronwill.night-config:toml:3.6.5'
// Transitive
include 'com.electronwill.night-config:toml:3.6.5'
include 'com.electronwill.night-config:core:3.6.5'


include "com.github.DarkKronicle.Konstruct:addons:${project.konstruct_version}"
include "com.github.DarkKronicle.Konstruct:core:${project.konstruct_version}"

implementation "org.mariuszgromada.math:MathParser.org-mXparser:${project.mxparser_version}"
include "org.mariuszgromada.math:MathParser.org-mXparser:${project.mxparser_version}"

implementation "io.github.maowimpl:owo:${project.owo_version}"
include "io.github.maowimpl:owo:${project.owo_version}"

implementation 'org.apache.commons:commons-csv:1.8'
include 'org.apache.commons:commons-csv:1.8'

// No Java source in this repo imports owo, but Konstruct's bundled `addons` jar
// calls dev.maow.owo.util.OwOFactory at runtime, so it must stay on the jar-in-jar
// list or AdvancedChatKonstruct dies with NoClassDefFoundError.
implementation "io.github.maowimpl:owo:${project.owo_version}"
include "io.github.maowimpl:owo:${project.owo_version}"
}

processResources {
Expand All @@ -70,22 +79,19 @@ processResources {

tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.options.release = 21
it.options.release = 25
// Default cap is 100; during the 26.2 port we want the whole list at once.
it.options.compilerArgs << "-Xmaxerrs" << "10000"
}

//task sourcesJar(type: Jar, dependsOn: classes) {
// classifier = "sources"
// from sourceSets.main.allSource
//}

tasks.register('sourcesJar', Jar) {
dependsOn classes
archiveClassifier.set('sources')
from sourceSets.main.allSource
}

jar {
from "LICENSE.txt"
from "LICENSE.txt"
}

tasks.register('downloadExtra') {
Expand All @@ -104,12 +110,13 @@ publishing {
publications {
mavenJava(MavenPublication) {
artifactId = 'advancedchatcore' // Set artifact ID in lowercase
// add all the jars that should be included when publishing to maven
artifact(remapJar) {
builtBy remapJar
// 26.2 needs no remapping, so `remapJar`/`remapSourcesJar` no longer
// exist and the plain jar tasks are the published artifacts.
artifact(jar) {
builtBy jar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
builtBy sourcesJar
}
}
}
Expand Down
26 changes: 14 additions & 12 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
org.gradle.jvmargs=-Xmx1G
org.gradle.jvmargs=-Xmx3G

# https://fabricmc.net/develop
minecraft_version=1.21.11
yarn_mappings=1.21.11+build.4
loader_version=0.18.4
loom_version=1.15-SNAPSHOT
fabric_api_version=0.141.3+1.21.11
# Minecraft 26.2 ships unobfuscated: there is no yarn or intermediary any more,
# so no `mappings` dependency is declared and the source uses Mojang names.
minecraft_version=26.2
loader_version=0.19.3
loom_version=1.17.+
fabric_api_version=0.156.0+26.2

mod_version=1.5.17-alpha.1
mod_version=1.7.2-alpha.1
maven_group=com.arematics
archives_base_name=AdvancedChatCore

# https://jitpack.io/#sakura-ryoko/malilib
malilib_version=1.21.11-0.27.5
# https://modrinth.com/mod/malilib (sakura-ryoko builds)
malilib_version=0.29.3
# https://jitpack.io/com/github/DarkKronicle/Konstruct
konstruct_version=2.0.3-build1
# https://repo.maven.apache.org/maven2/org/mariuszgromada/math/MathParser.org-mXparser
mxparser_version=6.1.0
# https://repo.maven.apache.org/maven2/io/github/maowimpl/owo
owo_version=2.0.0
# https://maven.terraformersmc.com/releases/com/terraformersmc/modmenu
modmenu_version=17.0.0-beta.2
modmenu_version=20.0.1
# https://projectlombok.org - 1.18.42+ is required for JDK 25
lombok_version=1.18.46

modrinth_slug=advancedchatcore-next
modrinth_id=iptu1EVO
Expand All @@ -34,3 +35,4 @@ project_color=0x134bff
changelog_hide_unimportant_commits=true
changelog_max_commit_search=200
discord_webhook_changelog_line_limit=10
owo_version=2.0.0
3 changes: 3 additions & 0 deletions gradle/gradle-daemon-jvm.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#This file is generated by updateDaemonJvm
#Minecraft 26.2 requires the Gradle daemon itself to run on Java 25.
toolchainVersion=25
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 @@
#Sun Jun 16 00:47:33 CEST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.6.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
5 changes: 5 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@ pluginManagement {
mavenCentral()
}
}

// Lets Gradle download a JDK 25 toolchain automatically, so no system JDK 25 is required.
plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayConnectionEvents;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.Minecraft;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Expand Down Expand Up @@ -66,13 +66,13 @@ public void onInitializeClient() {
// Important to get first since configuration options depend on colors
Colors.getInstance().load();
InitializationHandler.getInstance().registerInitializationHandler(new InitHandler());
MinecraftClient client = MinecraftClient.getInstance();
Minecraft client = Minecraft.getInstance();
ClientTickEvents.START_CLIENT_TICK.register(
s -> {
// Allow for delayed tasks to be added
SyncTaskQueue.getInstance().update(s.inGameHud.getTicks());
SyncTaskQueue.getInstance().update(s.gui.hud.getGuiTicks());
// Make sure we're not in the sleeping screen while awake
if (client.currentScreen instanceof AdvancedSleepingChatScreen
if (client.gui.screen() instanceof AdvancedSleepingChatScreen
&& !client.player.isSleeping()) {
GuiBase.openGui(null);
}
Expand Down Expand Up @@ -118,13 +118,13 @@ public static String getRandomString() {
* @return The server address if connected, 'singleplayer' if singleplayer, 'none' if none.
*/
public static String getServer() {
MinecraftClient client = MinecraftClient.getInstance();
if (client.isInSingleplayer()) {
Minecraft client = Minecraft.getInstance();
if (client.isLocalServer()) {
return "singleplayer";
}
if (client.getCurrentServerEntry() == null) {
if (client.getCurrentServer() == null) {
return "none";
}
return client.getCurrentServerEntry().address;
return client.getCurrentServer().ip;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import io.github.darkkronicle.advancedchatcore.util.TextUtil;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.MinecraftClient;
import net.minecraft.text.Text;
import net.minecraft.client.Minecraft;
import net.minecraft.network.chat.Component;

import java.util.*;

Expand Down Expand Up @@ -73,7 +73,7 @@ public void registerModHandlers() {
new HashMap<>();
for (StringMatch bad : profanity) {
insertions.put(bad, (current, match) ->
Text.literal("*".repeat(bad.end - bad.start)).fillStyle(current.getStyle())
Component.literal("*".repeat(bad.end - bad.start)).withStyle(current.getStyle())
);
}
text = TextUtil.replaceStrings(text, insertions);
Expand Down Expand Up @@ -101,33 +101,35 @@ public void registerModHandlers() {

InputHandler.getInstance().addDisplayName("core_general", "advancedchatcore.config.tab.hotkeysgeneral");
InputHandler.getInstance().add("core_general", ConfigStorage.Hotkeys.OPEN_CHAT.config, (action, key) -> {
if (MinecraftClient.getInstance().world == null) {
if (Minecraft.getInstance().level == null) {
return true;
}
GuiBase.openGui(new AdvancedChatScreen(""));
return true;
});
InputHandler.getInstance().add("core_general", ConfigStorage.Hotkeys.OPEN_CHAT_WITH_LAST.config, (action, key) -> {
if (MinecraftClient.getInstance().world == null) {
if (Minecraft.getInstance().level == null) {
return true;
}
GuiBase.openGui(new AdvancedChatScreen(0));
return true;
});
InputHandler.getInstance().add("core_general", ConfigStorage.Hotkeys.OPEN_CHAT_FREE_MOVEMENT.config, (action, key) -> {
if (MinecraftClient.getInstance().world == null) {
if (Minecraft.getInstance().level == null) {
return true;
}
// Manually update stuff so that movement keys are continued to be pressed
MinecraftClient client = MinecraftClient.getInstance();
if (client.currentScreen != null) {
client.currentScreen.removed();
Minecraft client = Minecraft.getInstance();
if (client.gui.screen() != null) {
client.gui.screen().removed();
}
client.currentScreen = new AdvancedChatScreen(true);
client.mouse.unlockCursor();
client.currentScreen.init(client.getWindow().getScaledWidth(), client.getWindow().getScaledHeight());
client.skipGameRender = false;;
client.updateWindowTitle();
// 26.2 moved the current screen onto Gui and made the field private, so the
// old direct assignment (which deliberately skipped the normal open path) now
// has to go through Gui#setScreen. That handles init itself, so the manual
// init call is gone. Minecraft#noRender no longer exists.
client.gui.setScreen(new AdvancedChatScreen(true));
client.mouseHandler.releaseMouse();
client.updateTitle();
return true;
});
InputHandler.getInstance().add("core_general", ConfigStorage.Hotkeys.TOGGLE_PERMANENT.config, (action, key) -> {
Expand Down
Loading