base mod created

This commit is contained in:
Mohammad-Ali Minaie
2018-10-08 09:07:47 -04:00
parent 0a7700c356
commit b86dedad2f
7848 changed files with 584664 additions and 1 deletions

View File

@@ -0,0 +1,37 @@
package net.minecraft.util;
import java.util.regex.Pattern;
import javax.annotation.Nullable;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class StringUtils
{
private static final Pattern PATTERN_CONTROL_CODE = Pattern.compile("(?i)\\u00A7[0-9A-FK-OR]");
/**
* Returns the time elapsed for the given number of ticks, in "mm:ss" format.
*/
@SideOnly(Side.CLIENT)
public static String ticksToElapsedTime(int ticks)
{
int i = ticks / 20;
int j = i / 60;
i = i % 60;
return i < 10 ? j + ":0" + i : j + ":" + i;
}
@SideOnly(Side.CLIENT)
public static String stripControlCodes(String text)
{
return PATTERN_CONTROL_CODE.matcher(text).replaceAll("");
}
/**
* Returns a value indicating whether the given string is null or empty.
*/
public static boolean isNullOrEmpty(@Nullable String string)
{
return org.apache.commons.lang3.StringUtils.isEmpty(string);
}
}