The great format and clean up. IMPORTANT: Read below.

All devs and contributors should use the provided formatter settings. 
If your IDE does not support the format, the rules are simple, it is the
default java formatting rules, with 200char line lengths and 1 extra
line after class definitions.
This commit is contained in:
tterrag1098 committed 2015-01-07 19:50:18 -05:00
1 parent 906c730a3c
commit 4cfcc874dc
136 files changed
+10365 -11272

No files matched your search

@@ -10,77 +10,71 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
public class BaseItem extends Item {
@Override
public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean par4){
getWrappedDesc(list, itemStack);
}
public static void getWrappedDesc(List<String> list, ItemStack stack)
{
String[] wrappedDesc;
wrappedDesc = wrap(StatCollector.translateToLocal(stack.getUnlocalizedName() + ".desc"), 35);
for (String element : wrappedDesc)
list.add(element.trim());
}
public static String[] wrap(String input, int len)
{
// return empty array for null text
if (input == null)
return new String[] {};
// return text if len is zero or less
if (len <= 0)
return new String[] { input };
@Override
public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean par4) {
getWrappedDesc(list, itemStack);
}
// return text if less than length
if (input.length() <= len)
return new String[] { input };
public static void getWrappedDesc(List<String> list, ItemStack stack) {
String[] wrappedDesc;
wrappedDesc = wrap(StatCollector.translateToLocal(stack.getUnlocalizedName() + ".desc"), 35);
for (String element : wrappedDesc)
list.add(element.trim());
}
char[] chars = input.toCharArray();
Vector lines = new Vector();
StringBuffer line = new StringBuffer();
StringBuffer word = new StringBuffer();
public static String[] wrap(String input, int len) {
// return empty array for null text
if (input == null)
return new String[] {};
for (char c : chars)
{
word.append(c);
// return text if len is zero or less
if (len <= 0)
return new String[] { input };
if (c == ' ')
{
if ((line.length() + word.length()) > len)
{
lines.add(line.toString());
line.delete(0, line.length());
}
// return text if less than length
if (input.length() <= len)
return new String[] { input };
line.append(word);
word.delete(0, word.length());
}
}
char[] chars = input.toCharArray();
Vector lines = new Vector();
StringBuffer line = new StringBuffer();
StringBuffer word = new StringBuffer();
// handle any extra chars in current word
if (word.length() > 0)
{
if ((line.length() + word.length()) > len)
{
for (char c : chars) {
word.append(c);
if (c == ' ') {
if ((line.length() + word.length()) > len) {
lines.add(line.toString());
line.delete(0, line.length());
}
line.append(word);
word.delete(0, word.length());
}
// handle extra line
if (line.length() > 0)
{
lines.add(line.toString());
}
String[] ret = new String[lines.size()];
int c = 0; // counter
for (Enumeration e = lines.elements(); e.hasMoreElements(); c++)
{
ret[c] = (String) e.nextElement();
}
return ret;
}
// handle any extra chars in current word
if (word.length() > 0) {
if ((line.length() + word.length()) > len) {
lines.add(line.toString());
line.delete(0, line.length());
}
line.append(word);
}
// handle extra line
if (line.length() > 0) {
lines.add(line.toString());
}
String[] ret = new String[lines.size()];
int c = 0; // counter
for (Enumeration e = lines.elements(); e.hasMoreElements(); c++) {
ret[c] = (String) e.nextElement();
}
return ret;
}
}