Cleanup: removed IEEP, removed redundant casts, fixed imports, fixed typos.

This commit is contained in:
RainWarrior committed 2016-03-24 22:22:20 +03:00
1 parent 7e4d7077a5
commit a9d23f5e78
133 files changed
+489 -623

No files matched your search

@@ -43,7 +43,7 @@ public abstract class CustomModLoadingErrorDisplayException extends EnhancedRunt
private static final long serialVersionUID = 1L;
/**
* Called after the GUI is inited by the parent code. You can do extra stuff here, maybe?
* Called after the GUI is initialized by the parent code. You can do extra stuff here, maybe?
*
* @param errorScreen The error screen we're painting
* @param fontRenderer A font renderer for you
@@ -186,7 +186,7 @@ public class FMLClientHandler implements IFMLSidedHandler
* @param resourceManager The resource manager
*/
@SuppressWarnings("unchecked")
public void beginMinecraftLoading(Minecraft minecraft, @SuppressWarnings("rawtypes") List resourcePackList, IReloadableResourceManager resourceManager)
public void beginMinecraftLoading(Minecraft minecraft, List<IResourcePack> resourcePackList, IReloadableResourceManager resourceManager)
{
detectOptifine();
SplashProgress.start();
@@ -626,7 +626,7 @@ public class FMLClientHandler implements IFMLSidedHandler
@Override
public void serverStopped()
{
// If the server crashes during startup, it might hang the client- reset the client so it can abend properly.
// If the server crashes during startup, it might hang the client - reset the client so it can abend properly.
MinecraftServer server = getServer();
if (server != null && !server.serverIsInRunLoop())
@@ -693,7 +693,7 @@ public class FMLClientHandler implements IFMLSidedHandler
{
try
{
client.launchIntegratedServer(comparator.getFileName(), comparator.getDisplayName(), (WorldSettings)null);
client.launchIntegratedServer(comparator.getFileName(), comparator.getDisplayName(), null);
}
catch (StartupQuery.AbortedException e)
{
@@ -735,7 +735,7 @@ public class FMLClientHandler implements IFMLSidedHandler
String type = jsonData.get("type").getAsString();
JsonArray modDataArray = jsonData.get("modList").getAsJsonArray();
boolean moddedClientAllowed = jsonData.has("clientModsAllowed") ? jsonData.get("clientModsAllowed").getAsBoolean() : true;
Builder<String, String> modListBldr = ImmutableMap.<String,String>builder();
Builder<String, String> modListBldr = ImmutableMap.builder();
for (JsonElement obj : modDataArray)
{
JsonObject modObj = obj.getAsJsonObject();
@@ -247,7 +247,7 @@ public class GuiModList extends GuiScreen
if (type != null)
{
for (GuiButton b : (List<GuiButton>)buttonList)
for (GuiButton b : buttonList)
{
if (SortType.getTypeForButton(b) != null)
{
@@ -414,7 +414,7 @@ public class GuiModList extends GuiScreen
lines.add("Child mods: " + selectedMod.getMetadata().getChildModList());
if (vercheck.status == Status.OUTDATED || vercheck.status == Status.BETA_OUTDATED)
lines.add("Update Avalible: " + (vercheck.url == null ? "" : vercheck.url));
lines.add("Update Available: " + (vercheck.url == null ? "" : vercheck.url));
lines.add(null);
lines.add(selectedMod.getMetadata().description);
@@ -567,7 +567,7 @@ public class GuiModList extends GuiScreen
if (line != null)
{
int k = -4;
for (ITextComponent part : (Iterable<ITextComponent>)line) {
for (ITextComponent part : line) {
if (!(part instanceof TextComponentString))
continue;
k += GuiModList.this.fontRendererObj.getStringWidth(((TextComponentString)part).getChatComponentText_TextValue());
@@ -6,12 +6,10 @@ import java.io.IOException;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiLabel;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiWorldSelection;
import net.minecraft.client.gui.GuiYesNo;
import net.minecraft.client.gui.GuiYesNoCallback;
import net.minecraft.world.WorldSettings;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import net.minecraftforge.fml.common.StartupQuery;
import net.minecraftforge.fml.common.ZipperUtil;
@@ -44,12 +42,12 @@ public class GuiOldSaveLoadConfirm extends GuiYesNo implements GuiYesNoCallback
for (k = 0; k < this.buttonList.size(); ++k)
{
((GuiButton)this.buttonList.get(k)).drawButton(this.mc, mouseX, mouseY);
this.buttonList.get(k).drawButton(this.mc, mouseX, mouseY);
}
for (k = 0; k < this.labelList.size(); ++k)
{
((GuiLabel)this.labelList.get(k)).drawLabel(this.mc, mouseX, mouseY);
this.labelList.get(k).drawLabel(this.mc, mouseX, mouseY);
}
}
@Override
@@ -84,7 +82,7 @@ public class GuiOldSaveLoadConfirm extends GuiYesNo implements GuiYesNoCallback
try
{
mc.launchIntegratedServer(dirName, saveName, (WorldSettings)null);
mc.launchIntegratedServer(dirName, saveName, null);
}
catch (StartupQuery.AbortedException e)
{
@@ -129,7 +129,8 @@ public abstract class GuiScrollingList
return x >= left && x <= right && entryIndex >= 0 && relativeY >= 0 && entryIndex < this.getSize() ? entryIndex : -1;
}
public void registerScrollButtons(@SuppressWarnings("rawtypes") List buttons, int upActionID, int downActionID)
// FIXME: is this correct/still needed?
public void registerScrollButtons(List<GuiButton> buttons, int upActionID, int downActionID)
{
this.scrollUpActionId = upActionID;
this.scrollDownActionId = downActionID;
@@ -1,55 +1,7 @@
package net.minecraftforge.fml.client;
import static org.lwjgl.opengl.GL11.GL_ALPHA_TEST;
import static org.lwjgl.opengl.GL11.GL_BLEND;
import static org.lwjgl.opengl.GL11.GL_COLOR_BUFFER_BIT;
import static org.lwjgl.opengl.GL11.GL_DEPTH_TEST;
import static org.lwjgl.opengl.GL11.GL_GREATER;
import static org.lwjgl.opengl.GL11.GL_LEQUAL;
import static org.lwjgl.opengl.GL11.GL_LIGHTING;
import static org.lwjgl.opengl.GL11.GL_MODELVIEW;
import static org.lwjgl.opengl.GL11.GL_NEAREST;
import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA;
import static org.lwjgl.opengl.GL11.GL_PROJECTION;
import static org.lwjgl.opengl.GL11.GL_QUADS;
import static org.lwjgl.opengl.GL11.GL_RENDERER;
import static org.lwjgl.opengl.GL11.GL_RGBA;
import static org.lwjgl.opengl.GL11.GL_SRC_ALPHA;
import static org.lwjgl.opengl.GL11.GL_TEXTURE_2D;
import static org.lwjgl.opengl.GL11.GL_TEXTURE_MAG_FILTER;
import static org.lwjgl.opengl.GL11.GL_TEXTURE_MIN_FILTER;
import static org.lwjgl.opengl.GL11.GL_VENDOR;
import static org.lwjgl.opengl.GL11.GL_VERSION;
import static org.lwjgl.opengl.GL11.glAlphaFunc;
import static org.lwjgl.opengl.GL11.glBegin;
import static org.lwjgl.opengl.GL11.glBindTexture;
import static org.lwjgl.opengl.GL11.glBlendFunc;
import static org.lwjgl.opengl.GL11.glClear;
import static org.lwjgl.opengl.GL11.glClearColor;
import static org.lwjgl.opengl.GL11.glColor3ub;
import static org.lwjgl.opengl.GL11.glDeleteTextures;
import static org.lwjgl.opengl.GL11.glDepthFunc;
import static org.lwjgl.opengl.GL11.glDisable;
import static org.lwjgl.opengl.GL11.glEnable;
import static org.lwjgl.opengl.GL11.glEnd;
import static org.lwjgl.opengl.GL11.glGenTextures;
import static org.lwjgl.opengl.GL11.glGetString;
import static org.lwjgl.opengl.GL11.glLoadIdentity;
import static org.lwjgl.opengl.GL11.glMatrixMode;
import static org.lwjgl.opengl.GL11.glOrtho;
import static org.lwjgl.opengl.GL11.glPopMatrix;
import static org.lwjgl.opengl.GL11.glPushMatrix;
import static org.lwjgl.opengl.GL11.glRotatef;
import static org.lwjgl.opengl.GL11.glScalef;
import static org.lwjgl.opengl.GL11.glTexCoord2f;
import static org.lwjgl.opengl.GL11.glTexImage2D;
import static org.lwjgl.opengl.GL11.glTexParameteri;
import static org.lwjgl.opengl.GL11.glTexSubImage2D;
import static org.lwjgl.opengl.GL11.glTranslatef;
import static org.lwjgl.opengl.GL11.glVertex2f;
import static org.lwjgl.opengl.GL11.glViewport;
import static org.lwjgl.opengl.GL12.GL_BGRA;
import static org.lwjgl.opengl.GL12.GL_UNSIGNED_INT_8_8_8_8_REV;
import static org.lwjgl.opengl.GL11.*;
import static org.lwjgl.opengl.GL12.*;
import java.awt.image.BufferedImage;
import java.io.File;
@@ -60,7 +12,6 @@ import java.io.InputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.lang.Thread.UncaughtExceptionHandler;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.util.Iterator;
import java.util.Properties;
@@ -99,7 +50,6 @@ import org.lwjgl.BufferUtils;
import org.lwjgl.LWJGLException;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.Drawable;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.SharedDrawable;
import org.lwjgl.util.glu.GLU;
@@ -503,8 +453,8 @@ public class SplashProgress
if (max_texture_size != -1) return max_texture_size;
for (int i = 0x4000; i > 0; i >>= 1)
{
GlStateManager.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (IntBuffer)null);
if (GlStateManager.glGetTexLevelParameteri(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_TEXTURE_WIDTH) != 0)
GlStateManager.glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGBA, i, i, 0, GL_RGBA, GL_UNSIGNED_BYTE, null);
if (GlStateManager.glGetTexLevelParameteri(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH) != 0)
{
max_texture_size = i;
return i;
@@ -599,7 +549,7 @@ public class SplashProgress
{
stream.println("SplashProgress has detected a error loading Minecraft.");
stream.println("This can sometimes be caused by bad video drivers.");
stream.println("We have automatically disabeled the new Splash Screen in config/splash.properties.");
stream.println("We have automatically disabled the new Splash Screen in config/splash.properties.");
stream.println("Try reloading minecraft before reporting any errors.");
}
};
@@ -613,7 +563,7 @@ public class SplashProgress
{
stream.println("SplashProgress has detected a error loading Minecraft.");
stream.println("This can sometimes be caused by bad video drivers.");
stream.println("Please try disabeling the new Splash Screen in config/splash.properties.");
stream.println("Please try disabling the new Splash Screen in config/splash.properties.");
stream.println("After doing so, try reloading minecraft before reporting any errors.");
}
};
@@ -835,7 +785,7 @@ public class SplashProgress
public static void checkGLError(String where)
{
int err = GL11.glGetError();
int err = glGetError();
if (err != 0)
{
throw new IllegalStateException(where + ": " + GLU.gluErrorString(err));
@@ -54,13 +54,13 @@ public class DummyConfigElement implements IConfigElement
/**
* This class provides a Dummy Category IConfigElement. It can be used to define a custom list of GUI entries that will
* appear on the child screen or to specify a custom IGuiConfigListEntryfor a special category.
* appear on the child screen or to specify a custom IGuiConfigListEntry for a special category.
*/
public static class DummyCategoryElement extends DummyConfigElement
{
public DummyCategoryElement(String name, String langKey, List<IConfigElement> childElements)
{
this(name, langKey, childElements, (Class<? extends IConfigEntry>) null);
this(name, langKey, childElements, null);
}
public DummyCategoryElement(String name, String langKey, Class<? extends IConfigEntry> customListEntryClass)
@@ -70,7 +70,7 @@ public class DummyConfigElement implements IConfigElement
public DummyCategoryElement(String name, String langKey, List<IConfigElement> childElements, Class<? extends IConfigEntry> customListEntryClass)
{
super(name, (Object) null, ConfigGuiType.CONFIG_CATEGORY, langKey);
super(name, null, ConfigGuiType.CONFIG_CATEGORY, langKey);
this.childElements = childElements;
this.configEntryClass = customListEntryClass;
isProperty = false;
@@ -84,7 +84,7 @@ public class DummyConfigElement implements IConfigElement
{
public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey, boolean isListFixedLength, int maxListLength, Pattern validStringPattern, Object minValue, Object maxValue)
{
super(name, (Object) null, type, langKey, minValue, maxValue);
super(name, null, type, langKey, minValue, maxValue);
this.defaultValues = defaultValues;
this.values = defaultValues;
this.isListFixedLength = isListFixedLength;
@@ -95,52 +95,52 @@ public class DummyConfigElement implements IConfigElement
public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey)
{
this(name, defaultValues, type, langKey, false, -1, (Pattern) null, (Object) null, (Object) null);
this(name, defaultValues, type, langKey, false, -1, null, null, null);
}
public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey, boolean isListFixedLength)
{
this(name, defaultValues, type, langKey, isListFixedLength, -1, (Pattern) null, (Object) null, (Object) null);
this(name, defaultValues, type, langKey, isListFixedLength, -1, null, null, null);
}
public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey, int maxListLength)
{
this(name, defaultValues, type, langKey, false, maxListLength, (Pattern) null, (Object) null, (Object) null);
this(name, defaultValues, type, langKey, false, maxListLength, null, null, null);
}
public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey, Object minValue, Object maxValue)
{
this(name, defaultValues, type, langKey, false, -1, (Pattern) null, minValue, maxValue);
this(name, defaultValues, type, langKey, false, -1, null, minValue, maxValue);
}
public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey, boolean isListFixedLength, Object minValue, Object maxValue)
{
this(name, defaultValues, type, langKey, isListFixedLength, -1, (Pattern) null, minValue, maxValue);
this(name, defaultValues, type, langKey, isListFixedLength, -1, null, minValue, maxValue);
}
public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey, int maxListLength, Object minValue, Object maxValue)
{
this(name, defaultValues, type, langKey, false, maxListLength, (Pattern) null, minValue, maxValue);
this(name, defaultValues, type, langKey, false, maxListLength, null, minValue, maxValue);
}
public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey, boolean isListFixedLength, int maxListLength, Object minValue, Object maxValue)
{
this(name, defaultValues, type, langKey, isListFixedLength, maxListLength, (Pattern) null, minValue, maxValue);
this(name, defaultValues, type, langKey, isListFixedLength, maxListLength, null, minValue, maxValue);
}
public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey, Pattern validStringPattern)
{
this(name, defaultValues, type, langKey, false, -1, validStringPattern, (Object) null, (Object) null);
this(name, defaultValues, type, langKey, false, -1, validStringPattern, null, null);
}
public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey, boolean isListFixedLength, Pattern validStringPattern)
{
this(name, defaultValues, type, langKey, isListFixedLength, -1, validStringPattern, (Object) null, (Object) null);
this(name, defaultValues, type, langKey, isListFixedLength, -1, validStringPattern, null, null);
}
public DummyListElement(String name, Object[] defaultValues, ConfigGuiType type, String langKey, int maxListLength, Pattern validStringPattern)
{
this(name, defaultValues, type, langKey, false, maxListLength, validStringPattern, (Object) null, (Object) null);
this(name, defaultValues, type, langKey, false, maxListLength, validStringPattern, null, null);
}
public DummyListElement setCustomEditListEntryClass(Class<? extends IArrayEntry> clazz)
@@ -168,18 +168,18 @@ public class DummyConfigElement implements IConfigElement
if (minValue == null)
{
if (type == ConfigGuiType.INTEGER)
this.minValue = (Integer) Integer.MIN_VALUE;
this.minValue = Integer.MIN_VALUE;
else if (type == ConfigGuiType.DOUBLE)
this.minValue = (Double) (-Double.MAX_VALUE);
this.minValue = -Double.MAX_VALUE;
}
else
this.minValue = minValue;
if (maxValue == null)
{
if (type == ConfigGuiType.INTEGER)
this.maxValue = (Integer) Integer.MAX_VALUE;
this.maxValue = Integer.MAX_VALUE;
else if (type == ConfigGuiType.DOUBLE)
this.maxValue = (Double) Double.MAX_VALUE;
this.maxValue = Double.MAX_VALUE;
}
else
this.maxValue = maxValue;
@@ -187,22 +187,22 @@ public class DummyConfigElement implements IConfigElement
public DummyConfigElement(String name, Object defaultValue, ConfigGuiType type, String langKey, Pattern validStringPattern)
{
this(name, defaultValue, type, langKey, (String[]) null, validStringPattern, (Object) null, (Object) null);
this(name, defaultValue, type, langKey, null, validStringPattern, null, null);
}
public DummyConfigElement(String name, Object defaultValue, ConfigGuiType type, String langKey, String[] validValues)
{
this(name, defaultValue, type, langKey, validValues, (Pattern) null, (Object) null, (Object) null);
this(name, defaultValue, type, langKey, validValues, null, null, null);
}
public DummyConfigElement(String name, Object defaultValue, ConfigGuiType type, String langKey)
{
this(name, defaultValue, type, langKey, (String[]) null, (Pattern) null, (Object) null, (Object) null);
this(name, defaultValue, type, langKey, null, null, null, null);
}
public DummyConfigElement(String name, Object defaultValue, ConfigGuiType type, String langKey, Object minValue, Object maxValue)
{
this(name, defaultValue, type, langKey, (String[]) null, (Pattern) null, minValue, maxValue);
this(name, defaultValue, type, langKey, null, null, minValue, maxValue);
}
public DummyConfigElement setCustomListEntryClass(Class<? extends IConfigEntry> clazz)
@@ -325,9 +325,9 @@ public class GuiConfig extends GuiScreen
if (title2 != null)
{
int strWidth = mc.fontRendererObj.getStringWidth(title2);
int elipsisWidth = mc.fontRendererObj.getStringWidth("...");
if (strWidth > width - 6 && strWidth > elipsisWidth)
title2 = mc.fontRendererObj.trimStringToWidth(title2, width - 6 - elipsisWidth).trim() + "...";
int ellipsisWidth = mc.fontRendererObj.getStringWidth("...");
if (strWidth > width - 6 && strWidth > ellipsisWidth)
title2 = mc.fontRendererObj.trimStringToWidth(title2, width - 6 - ellipsisWidth).trim() + "...";
this.drawCenteredString(this.fontRendererObj, title2, this.width / 2, 18, 16777215);
}
@@ -114,7 +114,7 @@ public class GuiConfigEntries extends GuiListExtended
if (configElement.getConfigEntryClass() != null)
try
{
this.listEntries.add((IConfigEntry) configElement.getConfigEntryClass()
this.listEntries.add(configElement.getConfigEntryClass()
.getConstructor(GuiConfig.class, GuiConfigEntries.class, IConfigElement.class)
.newInstance(this.owningScreen, this, configElement));
}
@@ -128,7 +128,7 @@ public class GuiEditArrayEntries extends GuiListExtended
public void addNewEntry(int index)
{
if (configElement.isList() && configElement.getType() == ConfigGuiType.BOOLEAN)
listEntries.add(index, new BooleanEntry(this.owningGui, this, this.configElement, Boolean.valueOf(true)));
listEntries.add(index, new BooleanEntry(this.owningGui, this, this.configElement, true));
else if (configElement.isList() && configElement.getType() == ConfigGuiType.INTEGER)
listEntries.add(index, new IntegerEntry(this.owningGui, this, this.configElement, 0));
else if (configElement.isList() && configElement.getType() == ConfigGuiType.DOUBLE)
@@ -519,7 +519,7 @@ public class GuiEditArrayEntries extends GuiListExtended
@Override
public Object getValue()
{
return Boolean.valueOf(value);
return value;
}
}
@@ -20,6 +20,6 @@ public class GuiMessageDialog extends GuiDisconnected
public void initGui()
{
super.initGui();
((GuiButton) buttonList.get(0)).displayString = I18n.format(buttonText);
buttonList.get(0).displayString = I18n.format(buttonText);
}
}
@@ -59,11 +59,11 @@ public class GuiUnicodeGlyphButton extends GuiButtonExt
String buttonText = this.displayString;
int glyphWidth = (int) (mc.fontRendererObj.getStringWidth(glyph) * glyphScale);
int strWidth = mc.fontRendererObj.getStringWidth(buttonText);
int elipsisWidth = mc.fontRendererObj.getStringWidth("...");
int ellipsisWidth = mc.fontRendererObj.getStringWidth("...");
int totalWidth = strWidth + glyphWidth;
if (totalWidth > width - 6 && totalWidth > elipsisWidth)
buttonText = mc.fontRendererObj.trimStringToWidth(buttonText, width - 6 - elipsisWidth).trim() + "...";
if (totalWidth > width - 6 && totalWidth > ellipsisWidth)
buttonText = mc.fontRendererObj.trimStringToWidth(buttonText, width - 6 - ellipsisWidth).trim() + "...";
strWidth = mc.fontRendererObj.getStringWidth(buttonText);
totalWidth = glyphWidth + strWidth;
@@ -57,7 +57,7 @@ public class ClientRegistry
/**
* Register a shader for an entity. This shader gets activated when a spectator begins spectating an entity.
* Vanilla examples of this are the green effect for creepers and the invert effect for endermans.
* Vanilla examples of this are the green effect for creepers and the invert effect for endermen.
*
* @param entityClass
* @param shader