Add missing Locale parameter to String.format calls, Fixes getArmorResource functionality on some locaales. (#8463)

This commit is contained in:
Take Weiland authored and GitHub committed 2022-02-15 09:27:10 -08:00
1 parent 21787234f4
commit c3e0b071a2
30 files changed
+107 -80

No files matched your search

@@ -1,6 +1,6 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2021.
* Copyright (c) 2016-2022.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -33,6 +33,7 @@ import java.lang.reflect.Field;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
public class ForgeConfigSpecTest
@@ -82,7 +83,7 @@ public class ForgeConfigSpecTest
final ForgeConfigSpec.ConfigValue<T> simpleValue = builder.define(configKey, defaultKeyValue);
final ForgeConfigSpec spec = builder.build();
final String configPath = String.format(TEST_CONFIG_PATH_TEMPLATE, testName);
final String configPath = String.format(Locale.ROOT, TEST_CONFIG_PATH_TEMPLATE, testName);
final File configFile = new File(configPath);
configFile.getParentFile().mkdirs();
configFile.createNewFile();
@@ -1,6 +1,6 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2021.
* Copyright (c) 2016-2022.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -44,6 +44,7 @@ import net.minecraftforge.fml.util.thread.EffectiveSide;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Locale;
import java.util.concurrent.ConcurrentLinkedQueue;
@Mod(CapabilitiesTest.MODID)
@@ -125,7 +126,7 @@ public class CapabilitiesTest
}
});
messages.add(String.format("Attached capability to %s in %s", event.getObject().getClass(), EffectiveSide.get()));
messages.add(String.format(Locale.ENGLISH, "Attached capability to %s in %s", event.getObject().getClass(), EffectiveSide.get()));
}
}
@@ -1,6 +1,6 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2021.
* Copyright (c) 2016-2022.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -29,6 +29,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
@@ -906,7 +907,7 @@ public class DataGeneratorTest
}
private void blockstateError(Block block, String fmt, Object... args) {
errors.add("Generated blockstate for block " + block + " " + String.format(fmt, args));
errors.add("Generated blockstate for block " + block + " " + String.format(Locale.ENGLISH, fmt, args));
}
@Override
@@ -1,6 +1,6 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2021.
* Copyright (c) 2016-2022.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -42,6 +42,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import javax.annotation.Nullable;
import java.util.Locale;
@Mod("be_onload_test")
public class BlockEntityOnLoadTest
@@ -120,7 +121,7 @@ public class BlockEntityOnLoadTest
LOGGER.info("[BE_ONLOAD] TestBlockEntity#tick at pos {} for {}", worldPosition, this);
if (!loaded)
{
throw new IllegalStateException(String.format("BlockEntity at %s ticked before onLoad()!", getBlockPos()));
throw new IllegalStateException(String.format(Locale.ENGLISH, "BlockEntity at %s ticked before onLoad()!", getBlockPos()));
}
}
}
@@ -1,6 +1,6 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2021.
* Copyright (c) 2016-2022.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -20,6 +20,7 @@
package net.minecraftforge.debug.block;
import java.util.List;
import java.util.Locale;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
@@ -93,7 +94,7 @@ public class PistonEventTest
{
if (pistonHelper.resolve())
{
player.sendMessage(new TextComponent(String.format("Piston will extend moving %d blocks and destroy %d blocks", pistonHelper.getToPush().size(), pistonHelper.getToDestroy().size())), player.getUUID());
player.sendMessage(new TextComponent(String.format(Locale.ENGLISH, "Piston will extend moving %d blocks and destroy %d blocks", pistonHelper.getToPush().size(), pistonHelper.getToDestroy().size())), player.getUUID());
}
else
{
@@ -138,7 +139,7 @@ public class PistonEventTest
BlockPos targetPos = event.getFaceOffsetPos().relative(event.getDirection());
boolean canPush = PistonBaseBlock.isPushable(event.getWorld().getBlockState(targetPos), (Level) event.getWorld(), event.getFaceOffsetPos(), event.getDirection().getOpposite(), false, event.getDirection());
boolean isAir = event.getWorld().isEmptyBlock(targetPos);
player.sendMessage(new TextComponent(String.format("Piston will retract moving %d blocks", !isAir && canPush ? 1 : 0)), player.getUUID());
player.sendMessage(new TextComponent(String.format(Locale.ENGLISH, "Piston will retract moving %d blocks", !isAir && canPush ? 1 : 0)), player.getUUID());
}
else
{
@@ -1,6 +1,6 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2021.
* Copyright (c) 2016-2022.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -30,6 +30,7 @@ import net.minecraftforge.fml.loading.FMLEnvironment;
import org.lwjgl.glfw.GLFW;
import java.util.List;
import java.util.Locale;
@Mod("overlay_layers_test")
public class OverlayLayersTest
@@ -57,7 +58,7 @@ public class OverlayLayersTest
for(int i=0;i<overlays.size();i++)
{
OverlayRegistry.OverlayEntry entry = overlays.get(i);
event.getLeft().add(String.format(overlayIndex == i ? "> %s [%s] <" : " %s [%s] ", entry.getDisplayName(), entry.isEnabled()));
event.getLeft().add(String.format(Locale.ENGLISH, overlayIndex == i ? "> %s [%s] <" : " %s [%s] ", entry.getDisplayName(), entry.isEnabled()));
}
}
@@ -1,6 +1,6 @@
/*
* Minecraft Forge
* Copyright (c) 2016-2021.
* Copyright (c) 2016-2022.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -26,6 +26,8 @@ import net.minecraftforge.fml.common.Mod;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.Locale;
@Mod(BiomeLoadingEventTest.MODID)
public class BiomeLoadingEventTest {
static final String MODID = "biome_loading_event_test";
@@ -38,6 +40,6 @@ public class BiomeLoadingEventTest {
}
public void onBiomeLoading(BiomeLoadingEvent event){
ResourceLocation biome = event.getName();
LOGGER.info(String.format("Biome loaded: %s", biome.toString()));
LOGGER.info("Biome loaded: {}", biome);
}
}