PlayerHelper: Localize chat messages on the client (#7)

This commit is contained in:
Discreater authored and GitHub committed 2025-12-20 15:30:00 +01:00
1 parent 9dad128f63
commit dafebb3091
4 files changed
+21 -9

No files matched your search

+10 -2
View File
@@ -96,7 +96,9 @@ usesMixinDebug = false
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
mixinPlugin =
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
# Specify the package that contains all of your Mixins. The package must exist or
# the build will fail. If you have a package property defined in your mixins.<modid>.json,
# it must match with this or the build will fail.
mixinsPackage =
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
@@ -151,7 +153,7 @@ modrinthProjectId =
# type can be one of [project, version],
# and the name is the Modrinth project or version slug/id of the other mod.
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
modrinthRelations =
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
@@ -172,6 +174,12 @@ curseForgeRelations =
# projects. New projects should not use this parameter.
# customArchiveBaseName =
# Optional parameter to customize the default working directory used by the runClient* tasks. Relative to the project directory.
# runClientWorkingDirectory = run/client
# Optional parameter to customize the default working directory used by the runServer* tasks. Relative to the project directory.
# runServerWorkingDirectory = run/server
# Optional parameter to have the build automatically fail if an illegal version is used.
# This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'.
# The check is ONLY performed if the version is a git tag.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
+1 -1
View File
@@ -17,7 +17,7 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.38'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.48'
}
@@ -2,7 +2,9 @@
package eu.usrv.yamcore.auxiliary;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.StatCollector;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.ChatStyle;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.Vec3;
import net.minecraftforge.common.util.FakePlayer;
@@ -43,8 +45,9 @@ public class PlayerHelper {
try {
pEntityPlayer.capabilities.disableDamage = false;
pEntityPlayer.sendPlayerAbilities();
if (pNotifyPlayer) PlayerChatHelper
.SendNotifyWarning(pEntityPlayer, StatCollector.translateToLocal("yamcore.char.protection.remove"));
if (pNotifyPlayer) pEntityPlayer.addChatMessage(
new ChatComponentTranslation("yamcore.char.protection.remove")
.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.DARK_PURPLE)));
} catch (Exception e) {
YAMCore.instance.getLogger().error("RemoveProtection failed to Remove player's protection");
YAMCore.instance.getLogger().DumpStack(e);
@@ -61,8 +64,9 @@ public class PlayerHelper {
try {
pEntityPlayer.capabilities.disableDamage = true;
pEntityPlayer.sendPlayerAbilities();
if (pNotifyPlayer) PlayerChatHelper
.SendNotifyPositive(pEntityPlayer, StatCollector.translateToLocal("yamcore.char.protection.give"));
if (pNotifyPlayer) pEntityPlayer.addChatMessage(
new ChatComponentTranslation("yamcore.char.protection.give")
.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.DARK_GREEN)));
} catch (Exception e) {
YAMCore.instance.getLogger().error("RemoveProtection failed to give a player protection");
YAMCore.instance.getLogger().DumpStack(e);