mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-20 04:09:51 +00:00
Remove some deprecated methods and clean up
This commit is contained in:
1 parent
7892ca922c
commit
9a09ff68aa
28 files changed
+45
-444
No files matched your search
@@ -1,3 +1,22 @@
|
||||
/*
|
||||
* Minecraft Forge
|
||||
* Copyright (c) 2016.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation version 2.1
|
||||
* of the License.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
package net.minecraftforge.fml.client;
|
||||
|
||||
import java.util.Set;
|
||||
@@ -37,25 +56,12 @@ public class DefaultGuiFactory implements IModGuiFactory
|
||||
return new GuiConfig(parentScreen, modid, title);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@Override
|
||||
public Class<? extends GuiScreen> mainConfigGuiClass()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public static IModGuiFactory forMod(ModContainer mod)
|
||||
{
|
||||
return new DefaultGuiFactory(mod.getModId(), mod.getName());
|
||||
|
||||
@@ -27,8 +27,6 @@ import java.util.regex.Pattern;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraftforge.fml.client.config.ConfigGuiType;
|
||||
@@ -141,12 +139,6 @@ public class FMLConfigGuiFactory implements IModGuiFactory
|
||||
return new FMLConfigGuiScreen(parentScreen);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiScreen> mainConfigGuiClass()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
private static final Set<RuntimeOptionCategoryElement> fmlCategories = ImmutableSet.of(new RuntimeOptionCategoryElement("HELP", "FML"));
|
||||
|
||||
@Override
|
||||
@@ -154,36 +146,4 @@ public class FMLConfigGuiFactory implements IModGuiFactory
|
||||
{
|
||||
return fmlCategories;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element)
|
||||
{
|
||||
return new RuntimeOptionGuiHandler() {
|
||||
@Override
|
||||
public void paint(int x, int y, int w, int h)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addWidgets(List<Gui> widgets, int x, int y, int w, int h)
|
||||
{
|
||||
widgets.add(new GuiButton(100, x+10, y+10, "HELLO"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionCallback(int actionId)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -281,15 +281,7 @@ public class GuiModList extends GuiScreen
|
||||
try
|
||||
{
|
||||
IModGuiFactory guiFactory = FMLClientHandler.instance().getGuiFactoryFor(selectedMod);
|
||||
GuiScreen newScreen = null;
|
||||
try
|
||||
{
|
||||
newScreen = guiFactory.createConfigGui(this);
|
||||
}
|
||||
catch (AbstractMethodError error)
|
||||
{
|
||||
newScreen = guiFactory.mainConfigGuiClass().getConstructor(GuiScreen.class).newInstance(this);
|
||||
}
|
||||
GuiScreen newScreen = guiFactory.createConfigGui(this);
|
||||
this.mc.displayGuiScreen(newScreen);
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -425,14 +417,7 @@ public class GuiModList extends GuiScreen
|
||||
configModButton.enabled = false;
|
||||
if (guiFactory != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
configModButton.enabled = guiFactory.hasConfigGui();
|
||||
}
|
||||
catch(AbstractMethodError error)
|
||||
{
|
||||
configModButton.enabled = guiFactory.mainConfigGuiClass() != null;
|
||||
}
|
||||
configModButton.enabled = guiFactory.hasConfigGui();
|
||||
}
|
||||
lines.add(selectedMod.getMetadata().name);
|
||||
lines.add(String.format("Version: %s (%s)", selectedMod.getDisplayVersion(), selectedMod.getVersion()));
|
||||
|
||||
@@ -19,14 +19,10 @@
|
||||
|
||||
package net.minecraftforge.fml.client;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* This is the interface you need to implement if you want to provide a customized config screen.
|
||||
* {@link DefaultGuiFactory} provides a default implementation of this interface and will be used
|
||||
@@ -67,31 +63,6 @@ public interface IModGuiFactory {
|
||||
* or null if no GUI is desired.
|
||||
*/
|
||||
public GuiScreen createConfigGui(GuiScreen parentScreen);
|
||||
|
||||
/**
|
||||
* Return the name of a class extending {@link GuiScreen}. This class will
|
||||
* be instantiated when the "config" button is pressed in the mod list. It will
|
||||
* have a single argument constructor - the "parent" screen, the same as all
|
||||
* Minecraft GUIs. The expected behaviour is that this screen will replace the
|
||||
* "mod list" screen completely, and will return to the mod list screen through
|
||||
* the parent link, once the appropriate action is taken from the config screen.
|
||||
*
|
||||
* A null from this method indicates that the mod does not provide a "config"
|
||||
* button GUI screen, and the config button will be hidden/disabled.
|
||||
*
|
||||
* This config GUI is anticipated to provide configuration to the mod in a friendly
|
||||
* visual way. It should not be abused to set internals such as IDs (they're gonna
|
||||
* keep disappearing anyway), but rather, interesting behaviours. This config GUI
|
||||
* is never run when a server game is running, and should be used to configure
|
||||
* desired behaviours that affect server state. Costs, mod game modes, stuff like that
|
||||
* can be changed here.
|
||||
*
|
||||
* @deprecated The method {@link IModGuiFactory.maingConfigGui(GuiScreen} is the recommended method.
|
||||
* @return A class that will be instantiated on clicks on the config button
|
||||
* or null if no GUI is desired.
|
||||
*/
|
||||
@Deprecated
|
||||
public Class<? extends GuiScreen> mainConfigGuiClass();
|
||||
|
||||
/**
|
||||
* Return a list of the "runtime" categories this mod wishes to populate with
|
||||
@@ -115,16 +86,6 @@ public interface IModGuiFactory {
|
||||
*/
|
||||
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories();
|
||||
|
||||
/**
|
||||
* Return an instance of a {@link RuntimeOptionGuiHandler} that handles painting the
|
||||
* right hand side option screen for the specified {@link RuntimeOptionCategoryElement}.
|
||||
*
|
||||
* @param element The element we wish to paint for
|
||||
* @return The Handler for painting it
|
||||
*/
|
||||
@Nullable
|
||||
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element);
|
||||
|
||||
/**
|
||||
* Represents an option category and entry in the runtime gui options list.
|
||||
*
|
||||
@@ -141,48 +102,4 @@ public interface IModGuiFactory {
|
||||
this.child = child;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Responsible for painting the mod specific section of runtime options GUI for a particular category
|
||||
*
|
||||
* @author cpw
|
||||
*
|
||||
* TODO remove in 1.11 - this was never fully implemented and will be removed
|
||||
*/
|
||||
@Deprecated
|
||||
public interface RuntimeOptionGuiHandler {
|
||||
/**
|
||||
* Called to add widgets to the screen, such as buttons.
|
||||
* GUI identifier numbers should start at 100 and increase.
|
||||
* The callback will be through {@link #actionCallback(int)}
|
||||
*
|
||||
* @param x X
|
||||
* @param y Y
|
||||
* @param w width
|
||||
* @param h height
|
||||
*/
|
||||
public void addWidgets(List<Gui> widgetList, int x, int y, int w, int h);
|
||||
|
||||
/**
|
||||
* Called to paint the rectangle specified.
|
||||
* @param x X
|
||||
* @param y Y
|
||||
* @param w width
|
||||
* @param h height
|
||||
*/
|
||||
public void paint(int x, int y, int w, int h);
|
||||
|
||||
/**
|
||||
* Called if a widget with id >= 100 is fired.
|
||||
*
|
||||
* @param actionId the actionId of the firing widget
|
||||
*/
|
||||
public void actionCallback(int actionId);
|
||||
|
||||
/**
|
||||
* Called when this handler is about to go away (probably replaced by another one, or closing the
|
||||
* option screen)
|
||||
*/
|
||||
public void close();
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,6 @@ import java.util.Map;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
import net.minecraftforge.common.util.Java6Utils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import net.minecraft.launchwrapper.LaunchClassLoader;
|
||||
@@ -146,7 +145,7 @@ public class FMLSanityChecker implements IFMLCallHook
|
||||
}
|
||||
finally
|
||||
{
|
||||
Java6Utils.closeZipQuietly(mcJarFile);
|
||||
IOUtils.closeQuietly(mcJarFile);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -24,7 +24,6 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
import net.minecraftforge.common.util.Java6Utils;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.LoaderException;
|
||||
import net.minecraftforge.fml.common.MetadataCollection;
|
||||
@@ -120,7 +119,7 @@ public class JarDiscoverer implements ITypeDiscoverer
|
||||
}
|
||||
finally
|
||||
{
|
||||
Java6Utils.closeZipQuietly(jar);
|
||||
IOUtils.closeQuietly(jar);
|
||||
}
|
||||
return foundMods;
|
||||
}
|
||||
|
||||
@@ -180,29 +180,6 @@ public class ReflectionHelper
|
||||
throw new UnableToFindClassException(classNames, err);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #findMethod(Class, String, String, Class[])}
|
||||
*/
|
||||
@Deprecated
|
||||
public static <E> Method findMethod(Class<? super E> clazz, E instance, String[] methodNames, Class<?>... methodTypes)
|
||||
{
|
||||
Throwable failed = null;
|
||||
for (String methodName : methodNames)
|
||||
{
|
||||
try
|
||||
{
|
||||
Method m = clazz.getDeclaredMethod(methodName, methodTypes);
|
||||
m.setAccessible(true);
|
||||
return m;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
failed = e;
|
||||
}
|
||||
}
|
||||
throw new UnableToFindMethodException(failed);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds a method with the specified name and parameters in the given class and makes it accessible.
|
||||
* Note: for performance, store the returned value and avoid calling this repeatedly.
|
||||
|
||||
@@ -36,7 +36,6 @@ import net.minecraft.util.IThreadListener;
|
||||
import net.minecraft.util.text.translation.LanguageMap;
|
||||
import net.minecraft.world.storage.SaveFormatOld;
|
||||
import net.minecraftforge.common.util.CompoundDataFixer;
|
||||
import net.minecraftforge.common.util.Java6Utils;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.FMLLog;
|
||||
import net.minecraftforge.fml.common.IFMLSidedHandler;
|
||||
@@ -277,7 +276,7 @@ public class FMLServerHandler implements IFMLSidedHandler
|
||||
finally
|
||||
{
|
||||
IOUtils.closeQuietly(stream);
|
||||
Java6Utils.closeZipQuietly(zip);
|
||||
IOUtils.closeQuietly(zip);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user