修复部分语言下toUpper/LowerCase的转换问题
This commit is contained in:
parent
b7d995feca
commit
8b6f6708c6
3 changed files with 10 additions and 5 deletions
|
@ -15,6 +15,7 @@ import org.jetbrains.annotations.Nullable;
|
|||
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
|
||||
@EventBusSubscriber(modid = Mod.MODID)
|
||||
public class LaunchableEntityTool {
|
||||
|
@ -94,9 +95,9 @@ public class LaunchableEntityTool {
|
|||
case "@sbw:damage" -> DoubleTag.valueOf(data.damage());
|
||||
case "@sbw:owner" -> NbtUtils.createUUID(data.shooter());
|
||||
case "@sbw:owner_string_lower" ->
|
||||
StringTag.valueOf(data.shooter().toString().replace("-", "").toLowerCase());
|
||||
StringTag.valueOf(data.shooter().toString().replace("-", "").toLowerCase(Locale.ENGLISH));
|
||||
case "@sbw:owner_string_upper" ->
|
||||
StringTag.valueOf(data.shooter().toString().replace("-", "").toUpperCase());
|
||||
StringTag.valueOf(data.shooter().toString().replace("-", "").toUpperCase(Locale.ENGLISH));
|
||||
case "@sbw:explosion_damage" -> DoubleTag.valueOf(data.explosionDamage());
|
||||
case "@sbw:explosion_radius" -> DoubleTag.valueOf(data.explosionRadius());
|
||||
case "@sbw:spread" -> DoubleTag.valueOf(data.spread());
|
||||
|
|
|
@ -12,6 +12,8 @@ import net.minecraft.world.item.Item;
|
|||
import net.neoforged.neoforge.registries.DeferredHolder;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class Perk {
|
||||
|
||||
public final String descriptionId;
|
||||
|
@ -28,7 +30,7 @@ public class Perk {
|
|||
boolean isFirst = true;
|
||||
for (char c : descriptionId.toCharArray()) {
|
||||
if (isFirst || useUpperCase) {
|
||||
builder.append(Character.toUpperCase(c));
|
||||
builder.append(String.valueOf(c).toUpperCase(Locale.ENGLISH));
|
||||
isFirst = false;
|
||||
useUpperCase = false;
|
||||
} else if (c == '_') {
|
||||
|
|
|
@ -9,6 +9,8 @@ import net.minecraft.world.entity.Entity;
|
|||
import net.minecraft.world.item.ItemStack;
|
||||
import net.neoforged.neoforge.registries.DeferredHolder;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public enum Ammo {
|
||||
HANDGUN(ChatFormatting.GREEN),
|
||||
RIFLE(ChatFormatting.AQUA),
|
||||
|
@ -40,7 +42,7 @@ public enum Ammo {
|
|||
Ammo(ChatFormatting color) {
|
||||
this.color = color;
|
||||
|
||||
var name = name().toLowerCase();
|
||||
var name = name().toLowerCase(Locale.ENGLISH);
|
||||
this.name = name;
|
||||
this.translationKey = "item.superbwarfare.ammo." + name;
|
||||
|
||||
|
@ -51,7 +53,7 @@ public enum Ammo {
|
|||
if (c == '_') {
|
||||
useUpperCase = true;
|
||||
} else if (useUpperCase) {
|
||||
builder.append(Character.toUpperCase(c));
|
||||
builder.append(String.valueOf(c).toUpperCase(Locale.ENGLISH));
|
||||
useUpperCase = false;
|
||||
} else {
|
||||
builder.append(c);
|
||||
|
|
Loading…
Add table
Reference in a new issue