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
@@ -215,7 +215,7 @@ public class FMLCommonHandler
{
if (brandings == null)
{
Builder<String> brd = ImmutableList.<String>builder();
Builder<String> brd = ImmutableList.builder();
brd.add(Loader.instance().getMCVersionString());
brd.add(Loader.instance().getMCPVersionString());
brd.add("Powered by Forge " + ForgeVersion.getVersion());
@@ -691,7 +691,7 @@ public class FMLCommonHandler
}
/**
* Loads a lang file, first searching for a marker to enable the 'extended' format {escape charaters}
* Loads a lang file, first searching for a marker to enable the 'extended' format {escape characters}
* If the marker is not found it simply returns and let the vanilla code load things.
* The Marker is 'PARSE_ESCAPES' by itself on a line starting with '#' as such:
* #PARSE_ESCAPES
@@ -35,7 +35,6 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.network.NetworkCheckHandler;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.network.internal.FMLNetworkHandler;
import net.minecraftforge.fml.common.registry.GameData;
import net.minecraftforge.fml.common.registry.PersistentRegistryManager;
import net.minecraftforge.fml.common.registry.VillagerRegistry;
import net.minecraftforge.fml.relauncher.Side;
@@ -167,7 +167,7 @@ public class FMLModContainer implements ModContainer
if (descriptor.containsKey("useMetadata"))
{
overridesMetadata = !((Boolean)descriptor.get("useMetadata")).booleanValue();
overridesMetadata = !((Boolean)descriptor.get("useMetadata"));
}
if (overridesMetadata || !modMetadata.useDependencyInformation)
@@ -400,7 +400,7 @@ public class FMLModContainer implements ModContainer
});
}
private void parseSimpleFieldAnnotation(SetMultimap<String, ASMData> annotations, String annotationClassName, Function<ModContainer, Object> retreiver) throws IllegalAccessException
private void parseSimpleFieldAnnotation(SetMultimap<String, ASMData> annotations, String annotationClassName, Function<ModContainer, Object> retriever) throws IllegalAccessException
{
String[] annName = annotationClassName.split("\\.");
String annotationName = annName[annName.length - 1];
@@ -431,7 +431,7 @@ public class FMLModContainer implements ModContainer
f = clz.getDeclaredField(targets.getObjectName());
f.setAccessible(true);
isStatic = Modifier.isStatic(f.getModifiers());
injectedMod = retreiver.apply(mc);
injectedMod = retriever.apply(mc);
}
catch (Exception e)
{
@@ -473,7 +473,7 @@ public class FMLModContainer implements ModContainer
{
len = certificates.length;
}
Builder<String> certBuilder = ImmutableList.<String>builder();
Builder<String> certBuilder = ImmutableList.builder();
for (int i = 0; i < len; i++)
{
certBuilder.add(CertificateHelper.getFingerprint(certificates[i]));
@@ -508,7 +508,7 @@ public class FMLModContainer implements ModContainer
List<Map<String, Object>> props = (List<Map<String, Object>>)descriptor.get("customProperties");
if (props != null)
{
com.google.common.collect.ImmutableMap.Builder<String, String> builder = ImmutableMap.<String, String>builder();
com.google.common.collect.ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
for (Map<String, Object> p : props)
{
builder.put((String)p.get("k"), (String)p.get("v"));
@@ -663,7 +663,7 @@ public class FMLModContainer implements ModContainer
{
return false;
}
return value.booleanValue();
return value;
}
@Override
@@ -55,7 +55,7 @@ public interface ILanguageAdapter {
catch (ClassNotFoundException e)
{
// Not a singleton, look for @Instance field as a fallback.
FMLLog.log(Level.INFO, e, "An error occured trying to load a proxy into %s.%s. Did you declare your mod as 'class' instead of 'object'?", proxyTarget.getSimpleName(), target.getName());
FMLLog.log(Level.INFO, e, "An error occurred trying to load a proxy into %s.%s. Did you declare your mod as 'class' instead of 'object'?", proxyTarget.getSimpleName(), target.getName());
return;
}
@@ -91,7 +91,7 @@ public interface ILanguageAdapter {
}
catch (InvocationTargetException e)
{
FMLLog.log(Level.ERROR, e, "An error occured trying to load a proxy into %s.%s", proxyTarget.getSimpleName(), target.getName());
FMLLog.log(Level.ERROR, e, "An error occurred trying to load a proxy into %s.%s", proxyTarget.getSimpleName(), target.getName());
throw new LoaderException(e);
}
@@ -148,7 +148,7 @@ public interface ILanguageAdapter {
setProxy(target, proxyTarget, proxy);
}
catch (Exception e) {
FMLLog.log(Level.ERROR, e, "An error occured trying to load a proxy into %s.%s", proxyTarget.getSimpleName(), target.getName());
FMLLog.log(Level.ERROR, e, "An error occurred trying to load a proxy into %s.%s", proxyTarget.getSimpleName(), target.getName());
throw new LoaderException(e);
}
}
@@ -237,7 +237,7 @@ public class LoadController
public ImmutableBiMap<ModContainer, Object> buildModObjectList()
{
ImmutableBiMap.Builder<ModContainer, Object> builder = ImmutableBiMap.<ModContainer, Object>builder();
ImmutableBiMap.Builder<ModContainer, Object> builder = ImmutableBiMap.builder();
for (ModContainer mc : activeModList)
{
if (!mc.isImmutable() && mc.getMod()!=null)
@@ -265,7 +265,7 @@ public class LoadController
{
if (exception instanceof InvocationTargetException)
{
errors.put(modContainer.getModId(), ((InvocationTargetException)exception).getCause());
errors.put(modContainer.getModId(), exception.getCause());
}
else
{
@@ -340,7 +340,7 @@ public class Loader
}
catch (Exception e)
{
FMLLog.log(Level.ERROR, e, "A problem occured instantiating the injected mod container %s", cont);
FMLLog.log(Level.ERROR, e, "A problem occurred instantiating the injected mod container %s", cont);
throw new LoaderException(e);
}
mods.add(new InjectedModContainer(mc,mc.getSource()));
@@ -104,7 +104,7 @@ public @interface Mod
/**
* The acceptable range of minecraft versions that this mod will load and run in
* The default ("empty string") indicates that the currently RUNNING minecraft version is acceptable.
* This means ANY version that the end user adds the mod to. Modders PLEASS set this.
* This means ANY version that the end user adds the mod to. Modders PLEASE set this.
* FML will refuse to run with an error if the minecraft version is not in this range across all mods.
* @return A version range as specified by the maven version range specification or the empty string
*/
@@ -77,7 +77,7 @@ public class ProxyInjector
}
catch (Exception e)
{
FMLLog.log(Level.ERROR, e, "An error occured trying to load a proxy into %s.%s", targ.getAnnotationInfo(), targ.getClassName(), targ.getObjectName());
FMLLog.log(Level.ERROR, e, "An error occurred trying to load a proxy into %s.%s", targ.getAnnotationInfo(), targ.getClassName(), targ.getObjectName());
throw new LoaderException(e);
}
}
@@ -219,7 +219,7 @@ public class AccessTransformer implements IClassTransformer
}
else
{
List<MethodNode> nowOverridable = Lists.newArrayList();
List<MethodNode> nowOverrideable = Lists.newArrayList();
for (MethodNode n : classNode.methods)
{
if ((n.name.equals(m.name) && n.desc.equals(m.desc)) || m.name.equals("*"))
@@ -236,7 +236,7 @@ public class AccessTransformer implements IClassTransformer
if (wasPrivate && !isNowPrivate)
{
nowOverridable.add(n);
nowOverrideable.add(n);
}
}
@@ -253,7 +253,7 @@ public class AccessTransformer implements IClassTransformer
}
}
replaceInvokeSpecial(classNode, nowOverridable);
replaceInvokeSpecial(classNode, nowOverrideable);
}
}
@@ -356,7 +356,7 @@ public class AccessTransformer implements IClassTransformer
if (!hasTransformer)
{
System.out.println("Culd not find a valid transformer to perform");
System.out.println("Could not find a valid transformer to perform");
System.exit(1);
}
@@ -27,7 +27,7 @@ public class DeobfuscationTransformer implements IClassTransformer, IClassNameTr
private static final int WRITER_FLAGS = ClassWriter.COMPUTE_MAXS | (RECALC_FRAMES ? ClassWriter.COMPUTE_FRAMES : 0);
private static final int READER_FLAGS = RECALC_FRAMES ? ClassReader.SKIP_FRAMES : ClassReader.EXPAND_FRAMES;
// COMPUTE_FRAMES causes classes to be loaded, which could cause issues if the classes do not exist.
// However in testing this has not happened. {As we run post SideTransfromer}
// However in testing this has not happened. {As we run post SideTransformer}
// If reported we need to add a custom implementation of ClassWriter.getCommonSuperClass
// that does not cause class loading.
@@ -35,7 +35,7 @@ public class EventSubscriberTransformer implements IClassTransformer
{
if (Modifier.isPrivate(methodNode.access))
{
String msg = "Cannot apply @SubsribeEvent to private method %s/%s%s";
String msg = "Cannot apply @SubscribeEvent to private method %s/%s%s";
throw new RuntimeException(String.format(msg, classNode.name, methodNode.name, methodNode.desc));
}
@@ -105,7 +105,7 @@ public class EventSubscriptionTransformer implements IClassTransformer
String listDesc = tList.getDescriptor();
String listDescM = Type.getMethodDescriptor(tList);
for (MethodNode method : (List<MethodNode>)classNode.methods)
for (MethodNode method : classNode.methods)
{
if (method.name.equals("setup") && method.desc.equals(voidDesc) && (method.access & ACC_PROTECTED) == ACC_PROTECTED) hasSetup = true;
if ((method.access & ACC_PUBLIC) == ACC_PUBLIC)
@@ -195,10 +195,10 @@ public class EventSubscriptionTransformer implements IClassTransformer
method.instructions.add(new VarInsnNode(ALOAD, 0));
method.instructions.add(new MethodInsnNode(INVOKESPECIAL, tSuper.getInternalName(), "setup", voidDesc, false));
method.instructions.add(new FieldInsnNode(GETSTATIC, classNode.name, "LISTENER_LIST", listDesc));
LabelNode initLisitener = new LabelNode();
method.instructions.add(new JumpInsnNode(IFNULL, initLisitener));
LabelNode initListener = new LabelNode();
method.instructions.add(new JumpInsnNode(IFNULL, initListener));
method.instructions.add(new InsnNode(RETURN));
method.instructions.add(initLisitener);
method.instructions.add(initListener);
method.instructions.add(new FrameNode(F_SAME, 0, null, 0, null));
method.instructions.add(new TypeInsnNode(NEW, tList.getInternalName()));
method.instructions.add(new InsnNode(DUP));
@@ -143,7 +143,7 @@ public class MarkerTransformer implements IClassTransformer
if (!hasTransformer)
{
System.out.println("Culd not find a valid transformer to perform");
System.out.println("Could not find a valid transformer to perform");
return;
}
@@ -63,7 +63,7 @@ public class ModAPITransformer implements IClassTransformer {
}
else
{
stripMethod(classNode, (String)optional.getObjectName());
stripMethod(classNode, optional.getObjectName());
}
}
@@ -40,7 +40,7 @@ public class SideTransformer implements IClassTransformer
ClassReader classReader = new ClassReader(bytes);
classReader.accept(classNode, 0);
if (remove((List<AnnotationNode>)classNode.visibleAnnotations, SIDE))
if (remove(classNode.visibleAnnotations, SIDE))
{
if (DEBUG)
{
@@ -53,7 +53,7 @@ public class SideTransformer implements IClassTransformer
while(fields.hasNext())
{
FieldNode field = fields.next();
if (remove((List<AnnotationNode>)field.visibleAnnotations, SIDE))
if (remove(field.visibleAnnotations, SIDE))
{
if (DEBUG)
{
@@ -66,7 +66,7 @@ public class SideTransformer implements IClassTransformer
while(methods.hasNext())
{
MethodNode method = methods.next();
if (remove((List<AnnotationNode>)method.visibleAnnotations, SIDE))
if (remove(method.visibleAnnotations, SIDE))
{
if (DEBUG)
{
@@ -64,7 +64,7 @@ public class TerminalTransformer implements IClassTransformer
{
FMLRelaunchLog.warning("=============================================================");
FMLRelaunchLog.warning("MOD HAS DIRECT REFERENCE System.exit() THIS IS NOT ALLOWED REROUTING TO FML!");
FMLRelaunchLog.warning("Offendor: %s.%s%s", ExitVisitor.this.clsName, mName, mDesc);
FMLRelaunchLog.warning("Offender: %s.%s%s", ExitVisitor.this.clsName, mName, mDesc);
FMLRelaunchLog.warning("Use FMLCommonHandler.exitJava instead");
FMLRelaunchLog.warning("=============================================================");
}
@@ -77,7 +77,7 @@ public class TerminalTransformer implements IClassTransformer
{
FMLRelaunchLog.warning("=============================================================");
FMLRelaunchLog.warning("MOD HAS DIRECT REFERENCE Runtime.exit() THIS IS NOT ALLOWED REROUTING TO FML!");
FMLRelaunchLog.warning("Offendor: %s.%s%s", ExitVisitor.this.clsName, mName, mDesc);
FMLRelaunchLog.warning("Offender: %s.%s%s", ExitVisitor.this.clsName, mName, mDesc);
FMLRelaunchLog.warning("Use FMLCommonHandler.exitJava instead");
FMLRelaunchLog.warning("=============================================================");
}
@@ -80,7 +80,7 @@ public class FMLDeobfuscatingRemapper extends Remapper {
List<String> srgList = srgSource.readLines();
rawMethodMaps = Maps.newHashMap();
rawFieldMaps = Maps.newHashMap();
Builder<String, String> builder = ImmutableBiMap.<String,String>builder();
Builder<String, String> builder = ImmutableBiMap.builder();
Splitter splitter = Splitter.on(CharMatcher.anyOf(": ")).omitEmptyStrings().trimResults();
for (String line : srgList)
{
@@ -134,7 +134,7 @@ public class FMLDeobfuscatingRemapper extends Remapper {
rawMethodMaps = Maps.newHashMap();
rawFieldMaps = Maps.newHashMap();
Builder<String, String> builder = ImmutableBiMap.<String,String>builder();
Builder<String, String> builder = ImmutableBiMap.builder();
Splitter splitter = Splitter.on(CharMatcher.anyOf(": ")).omitEmptyStrings().trimResults();
for (String line : srgList)
{
@@ -216,7 +216,7 @@ public class FMLDeobfuscatingRemapper extends Remapper {
ClassNode classNode = new ClassNode();
cr.accept(classNode, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
Map<String,String> resMap = Maps.newHashMap();
for (FieldNode fieldNode : (List<FieldNode>) classNode.fields) {
for (FieldNode fieldNode : classNode.fields) {
resMap.put(fieldNode.name, fieldNode.desc);
}
fieldDescriptions.put(owner, resMap);
@@ -224,7 +224,7 @@ public class FMLDeobfuscatingRemapper extends Remapper {
}
catch (IOException e)
{
FMLRelaunchLog.log(Level.ERROR,e, "A critical exception occured reading a class file %s", owner);
FMLRelaunchLog.log(Level.ERROR,e, "A critical exception occurred reading a class file %s", owner);
}
return null;
}
@@ -403,8 +403,8 @@ public class FMLDeobfuscatingRemapper extends Remapper {
findAndMergeSuperMaps(parentThing);
}
}
Map<String, String> methodMap = Maps.<String,String>newHashMap();
Map<String, String> fieldMap = Maps.<String,String>newHashMap();
Map<String, String> methodMap = Maps.newHashMap();
Map<String, String> fieldMap = Maps.newHashMap();
for (String parentThing : allParents)
{
if (methodNameMaps.containsKey(parentThing))
@@ -103,7 +103,7 @@ public class ASMDataTable
{
if (containerAnnotationData == null)
{
ImmutableMap.Builder<ModContainer, SetMultimap<String, ASMData>> mapBuilder = ImmutableMap.<ModContainer, SetMultimap<String,ASMData>>builder();
ImmutableMap.Builder<ModContainer, SetMultimap<String, ASMData>> mapBuilder = ImmutableMap.builder();
for (ModContainer cont : containers)
{
Multimap<String, ASMData> values = Multimaps.filterValues(globalAnnotationData, new ModContainerPredicate(cont));
@@ -35,7 +35,7 @@ import org.apache.logging.log4j.Level;
*
*/
public class FMLInterModComms {
private static final ImmutableList<IMCMessage> emptyIMCList = ImmutableList.<IMCMessage>of();
private static final ImmutableList<IMCMessage> emptyIMCList = ImmutableList.of();
private static ArrayListMultimap<String, IMCMessage> modMessages = ArrayListMultimap.create();
/**
@@ -71,7 +71,7 @@ public class Event
{
if (!isCancelable())
{
throw new IllegalArgumentException("Attempted to cancel a uncancelable event");
throw new IllegalArgumentException("Attempted to cancel a non cancellable event");
}
isCanceled = cancel;
}
@@ -109,7 +109,7 @@ public class Event
}
/**
* Called by the base constructor, this is used by ASM generated
* event classes to setup various functionality such as the listenerlist.
* event classes to setup various functionality such as the listener list.
*/
protected void setup()
{
@@ -4,7 +4,7 @@ public interface IEventExceptionHandler
{
/**
* Fired when a EventListener throws an exception for the specified event on the event bus.
* After this function returns, the original Throwable will be propogated upwards.
* After this function returns, the original Throwable will be propagated upwards.
*
* @param bus The bus the event is being fired on
* @param event The event that is being fired
@@ -7,9 +7,9 @@ import com.google.common.collect.Lists;
public class CollectionWrapperFactory {
/**
* Return a read only cast view of the supplied ungeneric collection, based on the element type given
* Return a read only cast view of the supplied raw collection, based on the element type given
* @param coll The collection to cast
* @param elementType the supertype contained in the collection
* @param elementType the super type contained in the collection
* @return a collection asserting that type relationship
*/
public static <T> Collection<T> wrap(@SuppressWarnings("rawtypes") Collection coll, Class<T> elementType)
@@ -19,9 +19,9 @@ public class CollectionWrapperFactory {
}
/**
* Return a read only cast view of the supplied ungeneric list, based on the element type given
* Return a read only cast view of the supplied raw list, based on the element type given
* @param list The list to cast
* @param elementType the supertype contained in the list
* @param elementType the super type contained in the list
* @return a list asserting that type relationship
*/
public static <T> List<T> wrap(@SuppressWarnings("rawtypes") List list, Class<T> elementType)
@@ -41,7 +41,7 @@ public class FMLDeobfTweaker implements ITweaker {
catch (Exception e)
{
// Load in the Loader, make sure he's ready to roll - this will initialize most of the rest of minecraft here
System.out.println("A CRITICAL PROBLEM OCCURED INITIALIZING MINECRAFT - LIKELY YOU HAVE AN INCORRECT VERSION FOR THIS FML");
System.out.println("A CRITICAL PROBLEM OCCURRED INITIALIZING MINECRAFT - LIKELY YOU HAVE AN INCORRECT VERSION FOR THIS FML");
throw new RuntimeException(e);
}
}
@@ -32,7 +32,7 @@ public class Yggdrasil
{
LogManager.getLogger("FMLTWEAK").error("-- Login failed! " + e.getMessage());
Throwables.propagate(e);
return; // dont set other variables
return; // don't set other variables
}
args.put("--username", auth.getSelectedProfile().getName());
@@ -240,7 +240,7 @@ public class ByteBufUtils {
// Add the tab for alignment
returnString.append('\t');
// Add final chararacters at right, after padding
// Add final characters at right, after padding
// If it was at the end of a line, print out the full line
if (i > 0 && (i % 16) == 0)
@@ -44,13 +44,12 @@ public abstract class FMLIndexedMessageToMessageCodec<A> extends MessageToMessag
}
public abstract void encodeInto(ChannelHandlerContext ctx, A msg, ByteBuf target) throws Exception;
@Override
protected final void encode(ChannelHandlerContext ctx, A msg, List<Object> out) throws Exception
{
PacketBuffer buffer = new PacketBuffer(Unpooled.buffer());
@SuppressWarnings("unchecked") // Stupid unnecessary cast I can't seem to kill
Class<? extends A> clazz = (Class<? extends A>) msg.getClass();
byte discriminator = types.get(clazz);
byte discriminator = types.get(msg.getClass());
buffer.writeByte(discriminator);
encodeInto(ctx, msg, buffer);
FMLProxyPacket proxy = new FMLProxyPacket(buffer/*.copy()*/, ctx.channel().attr(NetworkRegistry.FML_CHANNEL).get());
@@ -127,8 +127,8 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter {
@Override
public List<NetworkDispatcher> selectNetworks(Object args, ChannelHandlerContext context, FMLProxyPacket packet)
{
ImmutableList.Builder<NetworkDispatcher> builder = ImmutableList.<NetworkDispatcher>builder();
for (EntityPlayerMP player : (List<EntityPlayerMP>)FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayerList())
ImmutableList.Builder<NetworkDispatcher> builder = ImmutableList.builder();
for (EntityPlayerMP player : FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayerList())
{
NetworkDispatcher dispatcher = player.playerNetServerHandler.netManager.channel().attr(NetworkDispatcher.FML_DISPATCHER).get();
if (dispatcher != null) builder.add(dispatcher);
@@ -155,8 +155,8 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter {
public List<NetworkDispatcher> selectNetworks(Object args, ChannelHandlerContext context, FMLProxyPacket packet)
{
int dimension = (Integer)args;
ImmutableList.Builder<NetworkDispatcher> builder = ImmutableList.<NetworkDispatcher>builder();
for (EntityPlayerMP player : (List<EntityPlayerMP>)FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayerList())
ImmutableList.Builder<NetworkDispatcher> builder = ImmutableList.builder();
for (EntityPlayerMP player : FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayerList())
{
if (dimension == player.dimension)
{
@@ -189,8 +189,8 @@ public class FMLOutboundHandler extends ChannelOutboundHandlerAdapter {
public List<NetworkDispatcher> selectNetworks(Object args, ChannelHandlerContext context, FMLProxyPacket packet)
{
TargetPoint tp = (TargetPoint)args;
ImmutableList.Builder<NetworkDispatcher> builder = ImmutableList.<NetworkDispatcher>builder();
for (EntityPlayerMP player : (List<EntityPlayerMP>)FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayerList())
ImmutableList.Builder<NetworkDispatcher> builder = ImmutableList.builder();
for (EntityPlayerMP player : FMLCommonHandler.instance().getMinecraftServerInstance().getPlayerList().getPlayerList())
{
if (player.dimension == tp.dimension)
{
@@ -23,18 +23,17 @@ import net.minecraftforge.fml.common.FMLLog;
public class PacketLoggingHandler
{
@SuppressWarnings("rawtypes")
public static void register(NetworkManager manager)
public static void register(NetworkManager manager)
{
ChannelPipeline pipeline = manager.channel().pipeline();
final EnumPacketDirection direction = manager.getDirection();
if (manager.isLocalChannel())
{
pipeline.addBefore("packet_handler", "splitter", new SimpleChannelInboundHandler<Packet>()
pipeline.addBefore("packet_handler", "splitter", new SimpleChannelInboundHandler<Packet<?>>()
{
String prefix = (direction == EnumPacketDirection.SERVERBOUND ? "SERVER: C->S" : "CLIENT: S->C");
@Override
protected void channelRead0(ChannelHandlerContext ctx, Packet msg) throws Exception
protected void channelRead0(ChannelHandlerContext ctx, Packet<?> msg) throws Exception
{
PacketBuffer buf = new PacketBuffer(Unpooled.buffer());
msg.writePacketData(buf);
@@ -48,10 +47,10 @@ public class PacketLoggingHandler
@Override
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception
{
if (msg instanceof Packet)
if (msg instanceof Packet<?>)
{
PacketBuffer buf = new PacketBuffer(Unpooled.buffer());
((Packet)msg).writePacketData(buf);
((Packet<?>)msg).writePacketData(buf);
FMLLog.log(Level.DEBUG, "%s %s:\n%s", prefix, msg.getClass().getSimpleName(), ByteBufUtils.getContentDump(buf));
}
ctx.write(msg, promise);
@@ -50,8 +50,7 @@ import net.minecraftforge.fml.relauncher.Side;
import org.apache.logging.log4j.Level;
@SuppressWarnings("rawtypes")
public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet> implements ChannelOutboundHandler {
public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet<?>> implements ChannelOutboundHandler {
private static boolean DEBUG_HANDSHAKE = Boolean.parseBoolean(System.getProperty("fml.debugNetworkHandshake", "false"));
private static enum ConnectionState {
OPENING, AWAITING_HANDSHAKE, HANDSHAKING, HANDSHAKECOMPLETE, FINALIZING, CONNECTED;
@@ -97,7 +96,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet> imple
public NetworkDispatcher(NetworkManager manager)
{
super(Packet.class, false);
super(false);
this.manager = manager;
this.scm = null;
this.side = Side.CLIENT;
@@ -112,7 +111,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet> imple
public NetworkDispatcher(NetworkManager manager, PlayerList scm)
{
super(Packet.class, false);
super(false);
this.manager = manager;
this.scm = scm;
this.side = Side.SERVER;
@@ -130,7 +129,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet> imple
this.player = player;
insertIntoChannel();
Boolean fml = this.manager.channel().attr(NetworkRegistry.FML_MARKER).get();
if (fml != null && fml.booleanValue())
if (fml != null && fml)
{
//FML on client, send server hello
//TODO: Make this cleaner as it uses netty magic 0.o
@@ -189,7 +188,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet> imple
{
completeServerSideConnection(ConnectionType.MODDED);
}
// FORGE: sometimes the netqueue will tick while login is occuring, causing an NPE. We shouldn't tick until the connection is complete
// FORGE: sometimes the netqueue will tick while login is occurring, causing an NPE. We shouldn't tick until the connection is complete
if (this.playerEntity.playerNetServerHandler != this) return;
super.update();
}
@@ -242,7 +241,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet> imple
}
@Override
protected void channelRead0(ChannelHandlerContext ctx, Packet msg) throws Exception
protected void channelRead0(ChannelHandlerContext ctx, Packet<?> msg) throws Exception
{
boolean handled = false;
if (msg instanceof CPacketCustomPayload)
@@ -305,7 +304,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet> imple
{
kickWithMessage("This is modded. No modded response received. Bye!");
}
@SuppressWarnings("unchecked")
private void kickWithMessage(String message)
{
final TextComponentString TextComponentString = new TextComponentString(message);
@@ -322,7 +321,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet> imple
{
manager.closeChannel(TextComponentString);
}
}, new GenericFutureListener[0]);
}, (GenericFutureListener<? extends Future<? super Void>>[])null);
}
manager.channel().config().setAutoRead(false);
}
@@ -613,7 +612,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet> imple
public void processPart(PacketBuffer input) throws IOException
{
int part = (int)(input.readByte() & 0xFF);
int part = input.readByte() & 0xFF;
if (part != part_expected)
{
throw new IOException("Received FML MultiPart packet out of order, Expected " + part_expected + " Got " + part);
@@ -74,7 +74,7 @@ public class EntitySpawnHandler extends SimpleChannelInboundHandler<FMLMessage.E
entity = er.doCustomSpawning(spawnMsg);
} else
{
entity = (Entity) (cls.getConstructor(World.class).newInstance(wc));
entity = cls.getConstructor(World.class).newInstance(wc);
int offset = spawnMsg.entityId - entity.getEntityId();
entity.setEntityId(spawnMsg.entityId);
@@ -7,23 +7,22 @@ import java.io.IOException;
import java.util.List;
import java.util.UUID;
import net.minecraft.network.datasync.EntityDataManager;
import org.apache.logging.log4j.Level;
import com.google.common.base.Throwables;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.math.MathHelper;
import net.minecraft.network.datasync.EntityDataManager;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.ModContainer;
import net.minecraftforge.fml.common.network.ByteBufUtils;
import net.minecraftforge.fml.common.registry.EntityRegistry.EntityRegistration;
import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData;
import net.minecraftforge.fml.common.registry.IThrowableEntity;
import net.minecraftforge.fml.common.registry.EntityRegistry.EntityRegistration;
import net.minecraftforge.fml.relauncher.Side;
import org.apache.logging.log4j.Level;
import com.google.common.base.Throwables;
public abstract class FMLMessage {
public static class CompleteHandshake extends FMLMessage {
Side target;
@@ -104,7 +104,7 @@ public class FMLNetworkHandler
}
else
{
FMLLog.fine("Invalid attempt to open a local GUI on a dedicated server. This is likely a bug. GUIID: %s,%d", mc.getModId(), modGuiId);
FMLLog.fine("Invalid attempt to open a local GUI on a dedicated server. This is likely a bug. GUI ID: %s,%d", mc.getModId(), modGuiId);
}
}
@@ -102,7 +102,7 @@ public class FMLProxyPacket implements Packet<INetHandler> {
catch (Throwable t)
{
FMLLog.log(Level.ERROR, t, "There was a critical exception handling a packet on channel %s", channel);
dispatcher.rejectHandshake("A fatal error has occured, this connection is terminated");
dispatcher.rejectHandshake("A fatal error has occurred, this connection is terminated");
}
}
}
@@ -14,7 +14,7 @@ import net.minecraftforge.fml.relauncher.Side;
public class MessageContext {
/**
* The {@link INetHandler} for this message. It could be a client or server handler, depending
* on the {@link #side} recieved.
* on the {@link #side} received.
*/
public final INetHandler netHandler;
@@ -99,7 +99,7 @@ public class ClassPatchManager {
int inputChecksum = Hashing.adler32().hashBytes(inputData).asInt();
if (patch.inputChecksum != inputChecksum)
{
FMLRelaunchLog.severe("There is a binary discrepency between the expected input class %s (%s) and the actual class. Checksum on disk is %x, in patch %x. Things are probably about to go very wrong. Did you put something into the jar file?", mappedName, name, inputChecksum, patch.inputChecksum);
FMLRelaunchLog.severe("There is a binary discrepancy between the expected input class %s (%s) and the actual class. Checksum on disk is %x, in patch %x. Things are probably about to go very wrong. Did you put something into the jar file?", mappedName, name, inputChecksum, patch.inputChecksum);
if (!Boolean.parseBoolean(System.getProperty("fml.ignorePatchDiscrepancies","false")))
{
FMLRelaunchLog.severe("The game is going to exit, because this is a critical error, and it is very improbable that the modded game will work, please obtain clean jar files.");
@@ -13,13 +13,10 @@
package net.minecraftforge.fml.common.registry;
import java.util.BitSet;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.logging.log4j.Level;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLiving;
@@ -33,6 +30,8 @@ import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModContainer;
import net.minecraftforge.fml.common.network.internal.FMLMessage.EntitySpawnMessage;
import org.apache.logging.log4j.Level;
import com.google.common.base.Function;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.BiMap;
@@ -114,7 +113,7 @@ public class EntityRegistry
private static final EntityRegistry INSTANCE = new EntityRegistry();
private BitSet availableIndicies;
private BitSet availableIndices;
private ListMultimap<ModContainer, EntityRegistration> entityRegistrations = ArrayListMultimap.create();
private Map<String,ModContainer> entityNames = Maps.newHashMap();
private BiMap<Class<? extends Entity>, EntityRegistration> entityClassRegistrations = HashBiMap.create();
@@ -126,11 +125,11 @@ public class EntityRegistry
private EntityRegistry()
{
availableIndicies = new BitSet(256);
availableIndicies.set(1,255);
availableIndices = new BitSet(256);
availableIndices.set(1,255);
for (Object id : EntityList.idToClassMapping.keySet())
{
availableIndicies.clear((Integer)id);
availableIndices.clear((Integer)id);
}
}
@@ -310,11 +309,11 @@ public class EntityRegistry
FMLLog.log(Level.ERROR, "The entity ID %d for mod %s is not an unsigned byte and may not work", id, Loader.instance().activeModContainer().getModId());
}
if (!availableIndicies.get(realId))
if (!availableIndices.get(realId))
{
FMLLog.severe("The mod %s has attempted to register an entity ID %d which is already reserved. This could cause severe problems", Loader.instance().activeModContainer().getModId(), id);
}
availableIndicies.clear(realId);
availableIndices.clear(realId);
return realId;
}
@@ -418,10 +417,10 @@ public class EntityRegistry
@Deprecated
public static int findGlobalUniqueEntityId()
{
int res = instance().availableIndicies.nextSetBit(0);
int res = instance().availableIndices.nextSetBit(0);
if (res < 0)
{
throw new RuntimeException("No more entity indicies left");
throw new RuntimeException("No more entity indices left");
}
return res;
}
@@ -10,6 +10,15 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.registry.RegistryNamespacedDefaultedByKey;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.functions.GenericIterableFactory;
import net.minecraftforge.fml.common.registry.RegistryDelegate.Delegate;
import org.apache.commons.lang3.Validate;
import org.apache.logging.log4j.Level;
import com.google.common.base.Joiner;
import com.google.common.base.Throwables;
import com.google.common.collect.BiMap;
@@ -17,16 +26,6 @@ import com.google.common.collect.HashBiMap;
import com.google.common.collect.Iterators;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import net.minecraft.util.IntIdentityHashBiMap;
import org.apache.commons.lang3.Validate;
import org.apache.logging.log4j.Level;
import net.minecraft.util.ObjectIntIdentityMap;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.registry.RegistryNamespacedDefaultedByKey;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.functions.GenericIterableFactory;
import net.minecraftforge.fml.common.registry.RegistryDelegate.Delegate;
public class FMLControlledNamespacedRegistry<I> extends RegistryNamespacedDefaultedByKey<ResourceLocation, I>
{
@@ -21,7 +21,6 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.potion.Potion;
import net.minecraft.util.ObjectIntIdentityMap;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.registry.RegistryNamespaced;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.Loader;
@@ -91,6 +90,7 @@ public class GameData
return getMain().iBlockRegistry.getObject(new ResourceLocation(modId, name));
}
@Deprecated
static GameRegistry.UniqueIdentifier getUniqueName(Block block)
{
if (block == null)
@@ -101,6 +101,7 @@ public class GameData
return new GameRegistry.UniqueIdentifier(name);
}
@Deprecated
static GameRegistry.UniqueIdentifier getUniqueName(Item item)
{
if (item == null)
@@ -1,7 +1,6 @@
package net.minecraftforge.fml.common.registry;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
@@ -9,6 +8,20 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.block.BlockAir;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.EnhancedRuntimeException;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.StartupQuery;
import net.minecraftforge.fml.common.ZipperUtil;
import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent;
import org.apache.logging.log4j.Level;
import com.google.common.base.Function;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
@@ -19,21 +32,6 @@ import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.common.collect.Sets.SetView;
import org.apache.logging.log4j.Level;
import net.minecraft.block.Block;
import net.minecraft.block.BlockAir;
import net.minecraft.item.Item;
import net.minecraft.potion.Potion;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.EnhancedRuntimeException;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.StartupQuery;
import net.minecraftforge.fml.common.ZipperUtil;
import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent;
/**
* Persistent registry manager. Manages the registries loading from disk, and from network. Handles staging
* registry data before loading uniformly into the active registry, and keeps a frozen registry instance
@@ -52,18 +52,18 @@ public interface RegistryDelegate<T> {
*/
final class Delegate<T> implements RegistryDelegate<T>
{
private T referant;
private T referent;
private ResourceLocation name;
private final Class<T> type;
public Delegate(T referant, Class<T> type) {
this.referant = referant;
public Delegate(T referent, Class<T> type) {
this.referent = referent;
this.type = type;
}
@Override
public T get() {
return referant;
return referent;
}
@Override
@@ -82,7 +82,7 @@ public interface RegistryDelegate<T> {
void changeReference(T newTarget)
{
this.referant = newTarget;
this.referent = newTarget;
}
void setResourceName(ResourceLocation name) { this.name = name; }
@@ -14,12 +14,8 @@ package net.minecraftforge.fml.common.toposort;
import java.util.Set;
import org.apache.logging.log4j.Level;
import net.minecraftforge.fml.common.EnhancedRuntimeException;
import net.minecraftforge.fml.common.FMLLog;
import net.minecraftforge.fml.common.ModContainer;
import net.minecraftforge.fml.common.toposort.ModSortingException.SortingExceptionData;
public class ModSortingException extends EnhancedRuntimeException
{
@@ -181,7 +181,7 @@ public class TopologicalSort
}
FMLLog.severe("Mod Sorting failed.");
FMLLog.severe("Visting node %s", node);
FMLLog.severe("Visiting node %s", node);
FMLLog.severe("Current sorted list : %s", sortedResult);
FMLLog.severe("Visited set for this node : %s", visitedNodes);
FMLLog.severe("Explored node set : %s", expandedNodes);
@@ -227,7 +227,7 @@ public class CoreModManager {
if (loadPlugins.isEmpty())
{
throw new RuntimeException("A fatal error has occured - no valid fml load plugin was found - this is a completely corrupt FML installation.");
throw new RuntimeException("A fatal error has occurred - no valid fml load plugin was found - this is a completely corrupt FML installation.");
}
FMLRelaunchLog.fine("All fundamental core mods are successfully located");
@@ -613,7 +613,7 @@ public class CoreModManager {
Launch.blackboard.put("fml.deobfuscatedEnvironment", deobfuscatedEnvironment);
tweaker.injectCascadingTweak("net.minecraftforge.fml.common.launcher.FMLDeobfTweaker");
tweakSorting.put("net.minecraftforge.fml.common.launcher.FMLDeobfTweaker", Integer.valueOf(1000));
tweakSorting.put("net.minecraftforge.fml.common.launcher.FMLDeobfTweaker", 1000);
}
public static void injectCoreModTweaks(FMLInjectionAndSortingTweaker fmlInjectionAndSortingTweaker)
@@ -59,7 +59,7 @@ public class DebugDiffWriter implements DiffWriter {
if (ba[ix] == '\n')
System.err.print("\\n");
else
System.err.print(String.valueOf((char)((char) ba[ix])));
System.err.print(String.valueOf((char) ba[ix]));
//System.err.print("0x" + Integer.toHexString(buf[ix]) + " "); // hex output
}
System.err.println("");
@@ -170,7 +170,7 @@ public class GDiffWriter implements DiffWriter {
@Override
public void close() throws IOException {
this.flush();
output.write((byte)EOF);
output.write(EOF);
output.close();
}