CHANGE: Remove SRC from build, change version, remake message format
This commit is contained in:
@@ -28,15 +28,9 @@ fabricApi {
|
||||
}
|
||||
|
||||
repositories {
|
||||
// Add repositories to retrieve artifacts from in here.
|
||||
// You should only use this when depending on other mods because
|
||||
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
|
||||
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
|
||||
// for more information about repositories.
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// To change the versions see the gradle.properties file
|
||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||
implementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||
|
||||
@@ -58,10 +52,6 @@ processResources {
|
||||
|
||||
def targetJavaVersion = 25
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
// ensure that the encoding is set to UTF-8, no matter what the system default is
|
||||
// this fixes some edge cases with special characters not displaying correctly
|
||||
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
|
||||
// If Javadoc is generated, this must be specified in that task too.
|
||||
it.options.encoding = "UTF-8"
|
||||
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
|
||||
it.options.release.set(targetJavaVersion)
|
||||
@@ -73,10 +63,6 @@ java {
|
||||
if (JavaVersion.current() < javaVersion) {
|
||||
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
|
||||
}
|
||||
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
|
||||
// if it is present.
|
||||
// If you remove this line, sources will not be generated.
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
jar {
|
||||
@@ -85,7 +71,6 @@ jar {
|
||||
}
|
||||
}
|
||||
|
||||
// configure the maven publication
|
||||
publishing {
|
||||
publications {
|
||||
create("mavenJava", MavenPublication) {
|
||||
@@ -94,7 +79,6 @@ publishing {
|
||||
}
|
||||
}
|
||||
|
||||
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
|
||||
repositories {
|
||||
// Add repositories to publish to here.
|
||||
// Notice: This block does NOT have the same function as the block in the top level.
|
||||
|
||||
+1
-7
@@ -1,14 +1,8 @@
|
||||
# Done to increase the memory available to gradle.
|
||||
org.gradle.jvmargs=-Xmx2G
|
||||
# Fabric Properties
|
||||
# check these on https://modmuss50.me/fabric.html
|
||||
minecraft_version=26.1.2
|
||||
yarn_mappings=1.21.11+build.6
|
||||
loader_version=0.19.3
|
||||
# Mod Properties
|
||||
mod_version=1.0-SNAPSHOT
|
||||
mod_version=1.0
|
||||
maven_group=org.example1
|
||||
archives_base_name=localhost
|
||||
# Dependencies
|
||||
# check this on https://modmuss50.me/fabric.html
|
||||
fabric_version=0.155.2+26.1.2
|
||||
|
||||
@@ -16,17 +16,16 @@ public class ChatHandler {
|
||||
final float LOCAL_CHAT_RADIUS = 50;
|
||||
|
||||
ServerMessageEvents.ALLOW_CHAT_MESSAGE.register((message, sender, params) -> {
|
||||
// Отримуємо чистий текст, який написав гравець, замість toString()
|
||||
String text = message.signedContent();
|
||||
|
||||
ServerLevel serverLevel = sender.level();
|
||||
MinecraftServer server = serverLevel.getServer();
|
||||
List<ServerPlayer> players = server.getPlayerList().getPlayers();
|
||||
|
||||
String nickmane = sender.getDisplayName().getString();
|
||||
if (text.startsWith(prefix)) {
|
||||
|
||||
String actualMessage = text.substring(1).trim();
|
||||
Component globalMessage = Component.literal(sender.getDisplayName().getString() + ": " + actualMessage);
|
||||
Component globalMessage = Component.literal(nickmane + ": " + actualMessage);
|
||||
|
||||
for (ServerPlayer player : players) {
|
||||
player.sendSystemMessage(globalMessage);
|
||||
@@ -34,7 +33,9 @@ public class ChatHandler {
|
||||
|
||||
} else {
|
||||
|
||||
Component localMessage = Component.literal(sender.getDisplayName().getString() + ": " + text).withStyle(ChatFormatting.GRAY);
|
||||
Component localMessage = Component.literal(nickmane + ": ")
|
||||
.append(Component.literal(text)).withStyle(ChatFormatting.GRAY);
|
||||
|
||||
for (ServerPlayer player : players) {
|
||||
if (player.level() == serverLevel && player.distanceTo(sender) <= LOCAL_CHAT_RADIUS) {
|
||||
player.sendSystemMessage(localMessage);
|
||||
|
||||
Reference in New Issue
Block a user