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 06c5f5930f
commit 82792ed22e
136 files changed
+10365 -11272

No files matched your search

@@ -8,69 +8,60 @@ import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
public abstract class GuiHandler implements Comparable<Object>
{
static ArrayList<GuiHandler> items = new ArrayList<GuiHandler>();
public abstract class GuiHandler implements Comparable<Object> {
int index;
Object mod;
String name;
static ArrayList<GuiHandler> items = new ArrayList<GuiHandler>();
public GuiHandler(String n)
{
items.add(this);
name = n;
}
int index;
Object mod;
String name;
public void open(EntityPlayer player, World world, int x, int y, int z)
{
player.openGui(mod, index, world, x, y, z);
}
public GuiHandler(String n) {
items.add(this);
name = n;
}
@Override
public int compareTo(Object a)
{
return name.compareTo(((GuiHandler) a).name);
}
public void open(EntityPlayer player, World world, int x, int y, int z) {
player.openGui(mod, index, world, x, y, z);
}
public static void register(Object mod)
{
Collections.sort(items);
int index = 0;
@Override
public int compareTo(Object a) {
return name.compareTo(((GuiHandler) a).name);
}
for(GuiHandler h : items)
{
h.mod = mod;
h.index = index++;
}
public static void register(Object mod) {
Collections.sort(items);
int index = 0;
NetworkRegistry.INSTANCE.registerGuiHandler(mod, new IGuiHandler()
{
@Override
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
{
if(id < 0 || id >= items.size())
{
return null;
}
for (GuiHandler h : items) {
h.mod = mod;
h.index = index++;
}
return items.get(id).getServerGuiElement(id, player, world, x, y, z);
}
NetworkRegistry.INSTANCE.registerGuiHandler(mod, new IGuiHandler() {
@Override
public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z)
{
if(id < 0 || id >= items.size())
{
return null;
}
@Override
public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
if (id < 0 || id >= items.size()) {
return null;
}
return items.get(id).getClientGuiElement(id, player, world, x, y, z);
}
});
}
return items.get(id).getServerGuiElement(id, player, world, x, y, z);
}
public abstract Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z);
@Override
public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
if (id < 0 || id >= items.size()) {
return null;
}
public abstract Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z);
return items.get(id).getClientGuiElement(id, player, world, x, y, z);
}
});
}
public abstract Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z);
public abstract Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z);
}