mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 08:17:35 +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
@@ -104,16 +104,10 @@ public class ForgeGuiFactory implements IModGuiFactory
|
||||
|
||||
@Override
|
||||
public GuiScreen createConfigGui(GuiScreen parent) { return new ForgeConfigGui(parent); }
|
||||
|
||||
@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 class ForgeConfigGui extends GuiConfig
|
||||
{
|
||||
public ForgeConfigGui(GuiScreen parentScreen)
|
||||
|
||||
@@ -19,12 +19,10 @@
|
||||
|
||||
package net.minecraftforge.client.model.pipeline;
|
||||
|
||||
import net.minecraft.block.Block.EnumOffsetType;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.color.BlockColors;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
|
||||
@@ -62,14 +62,6 @@ public class DungeonHooks
|
||||
return rarity;
|
||||
}
|
||||
|
||||
// TODO: remove
|
||||
/** @deprecated use {@link #removeDungeonMob(ResourceLocation)} */
|
||||
@Deprecated
|
||||
public static int removeDungeonMob(String name)
|
||||
{
|
||||
return removeDungeonMob(new ResourceLocation(name));
|
||||
}
|
||||
|
||||
/**
|
||||
* Will completely remove a Mob from the dungeon spawn list.
|
||||
*
|
||||
|
||||
@@ -1032,52 +1032,27 @@ public class ForgeHooks
|
||||
return git == null ? null : git.hitVec;
|
||||
}
|
||||
|
||||
// TODO 1.12 remove these three
|
||||
@Deprecated
|
||||
public static boolean onInteractEntityAt(EntityPlayer player, Entity entity, RayTraceResult ray, EnumHand hand)
|
||||
{
|
||||
return onInteractEntityAtAction(player, entity, ray, hand) != null;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static boolean onInteractEntityAt(EntityPlayer player, Entity entity, Vec3d vec3d, EnumHand hand)
|
||||
{
|
||||
return onInteractEntityAtAction(player, entity, vec3d, hand) != null;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static boolean onInteractEntity(EntityPlayer player, Entity entity, EnumHand hand)
|
||||
{
|
||||
return onInteractEntityAction(player, entity, hand) != null;
|
||||
}
|
||||
|
||||
public static EnumActionResult onInteractEntityAtAction(EntityPlayer player, Entity entity, RayTraceResult ray, EnumHand hand)
|
||||
public static EnumActionResult onInteractEntityAt(EntityPlayer player, Entity entity, RayTraceResult ray, EnumHand hand)
|
||||
{
|
||||
Vec3d vec3d = new Vec3d(ray.hitVec.x - entity.posX, ray.hitVec.y - entity.posY, ray.hitVec.z - entity.posZ);
|
||||
return onInteractEntityAtAction(player, entity, vec3d, hand);
|
||||
return onInteractEntityAt(player, entity, vec3d, hand);
|
||||
}
|
||||
|
||||
public static EnumActionResult onInteractEntityAtAction(EntityPlayer player, Entity entity, Vec3d vec3d, EnumHand hand)
|
||||
public static EnumActionResult onInteractEntityAt(EntityPlayer player, Entity entity, Vec3d vec3d, EnumHand hand)
|
||||
{
|
||||
PlayerInteractEvent.EntityInteractSpecific evt = new PlayerInteractEvent.EntityInteractSpecific(player, hand, entity, vec3d);
|
||||
MinecraftForge.EVENT_BUS.post(evt);
|
||||
return evt.isCanceled() ? evt.getCancellationResult() : null;
|
||||
}
|
||||
|
||||
public static EnumActionResult onInteractEntityAction(EntityPlayer player, Entity entity, EnumHand hand)
|
||||
public static EnumActionResult onInteractEntity(EntityPlayer player, Entity entity, EnumHand hand)
|
||||
{
|
||||
PlayerInteractEvent.EntityInteract evt = new PlayerInteractEvent.EntityInteract(player, hand, entity);
|
||||
MinecraftForge.EVENT_BUS.post(evt);
|
||||
return evt.isCanceled() ? evt.getCancellationResult() : null;
|
||||
}
|
||||
|
||||
@Deprecated // TODO 1.12 remove
|
||||
public static boolean onItemRightClick(EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
return onItemRightClickAction(player, hand) != null;
|
||||
}
|
||||
|
||||
public static EnumActionResult onItemRightClickAction(EntityPlayer player, EnumHand hand)
|
||||
public static EnumActionResult onItemRightClick(EntityPlayer player, EnumHand hand)
|
||||
{
|
||||
PlayerInteractEvent.RightClickItem evt = new PlayerInteractEvent.RightClickItem(player, hand);
|
||||
MinecraftForge.EVENT_BUS.post(evt);
|
||||
@@ -1108,14 +1083,6 @@ public class ForgeHooks
|
||||
MinecraftForge.EVENT_BUS.post(new PlayerInteractEvent.LeftClickEmpty(player));
|
||||
}
|
||||
|
||||
// TODO: remove
|
||||
/** @deprecated use {@link ForgeHooks#onEmptyLeftClick(EntityPlayer)} */
|
||||
@Deprecated
|
||||
public static void onEmptyLeftClick(EntityPlayer player, @Nonnull ItemStack stack)
|
||||
{
|
||||
onEmptyLeftClick(player);
|
||||
}
|
||||
|
||||
private static ThreadLocal<Deque<LootTableContext>> lootContext = new ThreadLocal<Deque<LootTableContext>>();
|
||||
private static LootTableContext getLootTableContext()
|
||||
{
|
||||
@@ -1127,14 +1094,6 @@ public class ForgeHooks
|
||||
return ctx;
|
||||
}
|
||||
|
||||
// TODO: remove
|
||||
/** @deprecated use {@link ForgeHooks#loadLootTable(Gson, ResourceLocation, String, boolean, LootTableManager)} */
|
||||
@Deprecated
|
||||
public static LootTable loadLootTable(Gson gson, ResourceLocation name, String data, boolean custom)
|
||||
{
|
||||
return loadLootTable(gson, name, data, custom, null);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static LootTable loadLootTable(Gson gson, ResourceLocation name, String data, boolean custom, LootTableManager lootTableManager)
|
||||
{
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* 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.common.util;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
public class Java6Utils
|
||||
{
|
||||
/**
|
||||
* {@link ZipFile} does not implement {@link Closeable} on Java 6.
|
||||
* This method is the same as {@link IOUtils#closeQuietly(Closeable)} but works on {@link ZipFile} on Java 6.
|
||||
*/
|
||||
public static void closeZipQuietly(@Nullable ZipFile file)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (file != null)
|
||||
{
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,8 +28,6 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
import net.minecraftforge.fml.common.eventhandler.GenericEvent;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Fired whenever an object with Capabilities support {currently TileEntity/Item/Entity)
|
||||
* is created. Allowing for the attachment of arbitrary capability providers.
|
||||
@@ -40,20 +38,13 @@ import javax.annotation.Nonnull;
|
||||
public class AttachCapabilitiesEvent<T> extends GenericEvent<T>
|
||||
{
|
||||
private final T obj;
|
||||
final Map<ResourceLocation, ICapabilityProvider> caps;// package-private for ForgeEventFactory
|
||||
private final Map<ResourceLocation, ICapabilityProvider> view;
|
||||
private final Map<ResourceLocation, ICapabilityProvider> caps = Maps.newLinkedHashMap();
|
||||
private final Map<ResourceLocation, ICapabilityProvider> view = Collections.unmodifiableMap(caps);
|
||||
|
||||
public AttachCapabilitiesEvent(Class<T> type, T obj)
|
||||
{
|
||||
this(type, obj, Maps.<ResourceLocation, ICapabilityProvider>newLinkedHashMap());
|
||||
}
|
||||
// package-private for ForgeEventFactory
|
||||
AttachCapabilitiesEvent(Class<T> type, T obj, Map<ResourceLocation, ICapabilityProvider> caps)
|
||||
{
|
||||
super(type);
|
||||
this.obj = obj;
|
||||
this.caps = caps;
|
||||
this.view = Collections.unmodifiableMap(caps);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,22 +77,4 @@ public class AttachCapabilitiesEvent<T> extends GenericEvent<T>
|
||||
{
|
||||
return view;
|
||||
}
|
||||
|
||||
/**
|
||||
* A version of the parent event which is only fired for ItemStacks.
|
||||
*/
|
||||
public static class Item extends AttachCapabilitiesEvent<net.minecraft.item.Item>
|
||||
{
|
||||
private final net.minecraft.item.ItemStack stack;
|
||||
public Item(net.minecraft.item.Item item, @Nonnull net.minecraft.item.ItemStack stack)
|
||||
{
|
||||
super(net.minecraft.item.Item.class, item);
|
||||
this.stack = stack;
|
||||
}
|
||||
@Nonnull
|
||||
public net.minecraft.item.ItemStack getItemStack()
|
||||
{
|
||||
return this.stack;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,13 +22,10 @@ package net.minecraftforge.event;
|
||||
import java.io.File;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
@@ -40,7 +37,6 @@ import net.minecraft.entity.passive.EntityAnimal;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayer.SleepResult;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResult;
|
||||
@@ -54,7 +50,6 @@ import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.text.ChatType;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.village.Village;
|
||||
@@ -127,7 +122,7 @@ import javax.annotation.Nullable;
|
||||
public class ForgeEventFactory
|
||||
{
|
||||
|
||||
public static MultiPlaceEvent onPlayerMultiBlockPlace(EntityPlayer player, List<BlockSnapshot> blockSnapshots, EnumFacing direction, @Nullable EnumHand hand)
|
||||
public static MultiPlaceEvent onPlayerMultiBlockPlace(EntityPlayer player, List<BlockSnapshot> blockSnapshots, EnumFacing direction, EnumHand hand)
|
||||
{
|
||||
BlockSnapshot snap = blockSnapshots.get(0);
|
||||
IBlockState placedAgainst = snap.getWorld().getBlockState(snap.getPos().offset(direction.getOpposite()));
|
||||
@@ -400,9 +395,9 @@ public class ForgeEventFactory
|
||||
return event.getExtraLife();
|
||||
}
|
||||
|
||||
public static int onItemPickup(EntityItem entityItem, EntityPlayer entityIn, ItemStack itemstack)
|
||||
public static int onItemPickup(EntityItem entityItem, EntityPlayer player)
|
||||
{
|
||||
Event event = new EntityItemPickupEvent(entityIn, entityItem);
|
||||
Event event = new EntityItemPickupEvent(player, entityItem);
|
||||
if (MinecraftForge.EVENT_BUS.post(event)) return -1;
|
||||
return event.getResult() == Result.ALLOW ? 1 : 0;
|
||||
}
|
||||
@@ -561,15 +556,9 @@ public class ForgeEventFactory
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static CapabilityDispatcher gatherCapabilities(Item item, ItemStack stack, ICapabilityProvider parent)
|
||||
public static CapabilityDispatcher gatherCapabilities(ItemStack stack, ICapabilityProvider parent)
|
||||
{
|
||||
// first fire the legacy event
|
||||
AttachCapabilitiesEvent.Item legacyEvent = new AttachCapabilitiesEvent.Item(item, stack);
|
||||
MinecraftForge.EVENT_BUS.post(legacyEvent);
|
||||
|
||||
// fire new event with the caps that were already registered on the legacy event
|
||||
AttachCapabilitiesEvent<ItemStack> event = new AttachCapabilitiesEvent<ItemStack>(ItemStack.class, stack, legacyEvent.caps);
|
||||
return gatherCapabilities(event, parent);
|
||||
return gatherCapabilities(new AttachCapabilitiesEvent<ItemStack>(ItemStack.class, stack), parent);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -41,14 +41,6 @@ public class LootTableLoadEvent extends Event
|
||||
private LootTable table;
|
||||
private LootTableManager lootTableManager;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #LootTableLoadEvent(ResourceLocation, LootTable, LootTableManager)}<br>
|
||||
*/
|
||||
@Deprecated
|
||||
public LootTableLoadEvent(ResourceLocation name, LootTable table) {
|
||||
this(name, table, null);
|
||||
}
|
||||
|
||||
public LootTableLoadEvent(ResourceLocation name, LootTable table, LootTableManager lootTableManager)
|
||||
{
|
||||
this.name = name;
|
||||
|
||||
@@ -51,15 +51,6 @@ public class BonemealEvent extends PlayerEvent
|
||||
private final EnumHand hand;
|
||||
private final ItemStack stack;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #BonemealEvent(EntityPlayer, World, BlockPos, IBlockState, EnumHand, ItemStack)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public BonemealEvent(EntityPlayer player, World world, BlockPos pos, IBlockState block)
|
||||
{
|
||||
this(player, world, pos, block, null, ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
public BonemealEvent(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState block, @Nullable EnumHand hand,
|
||||
@Nonnull ItemStack stack)
|
||||
{
|
||||
|
||||
@@ -318,14 +318,6 @@ public class PlayerInteractEvent extends PlayerEvent
|
||||
{
|
||||
super(player, EnumHand.MAIN_HAND, new BlockPos(player), null);
|
||||
}
|
||||
|
||||
// TODO: remove
|
||||
/** @deprecated use {@link LeftClickEmpty(EntityPlayer)} */
|
||||
@Deprecated
|
||||
public LeftClickEmpty(EntityPlayer player, @Nonnull ItemStack stack)
|
||||
{
|
||||
this(player);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,13 +35,10 @@ import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.util.BlockSnapshot;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event.HasResult;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event.Result;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class BlockEvent extends Event
|
||||
{
|
||||
@@ -177,12 +174,6 @@ public class BlockEvent extends Event
|
||||
private final IBlockState placedAgainst;
|
||||
private final EnumHand hand;
|
||||
|
||||
@Deprecated
|
||||
public PlaceEvent(BlockSnapshot blockSnapshot, IBlockState placedAgainst, EntityPlayer player)
|
||||
{
|
||||
this(blockSnapshot, placedAgainst, player, EnumHand.MAIN_HAND);
|
||||
}
|
||||
|
||||
public PlaceEvent(@Nonnull BlockSnapshot blockSnapshot, @Nonnull IBlockState placedAgainst, @Nonnull EntityPlayer player, @Nonnull EnumHand hand) {
|
||||
super(blockSnapshot.getWorld(), blockSnapshot.getPos(), blockSnapshot.getCurrentBlock());
|
||||
this.player = player;
|
||||
@@ -218,12 +209,6 @@ public class BlockEvent extends Event
|
||||
{
|
||||
private final List<BlockSnapshot> blockSnapshots;
|
||||
|
||||
@Deprecated
|
||||
public MultiPlaceEvent(List<BlockSnapshot> blockSnapshots, IBlockState placedAgainst, EntityPlayer player)
|
||||
{
|
||||
this(blockSnapshots, placedAgainst, player, EnumHand.MAIN_HAND);
|
||||
}
|
||||
|
||||
public MultiPlaceEvent(@Nonnull List<BlockSnapshot> blockSnapshots, @Nonnull IBlockState placedAgainst, @Nonnull EntityPlayer player, @Nonnull EnumHand hand) {
|
||||
super(blockSnapshots.get(0), placedAgainst, player, hand);
|
||||
this.blockSnapshots = ImmutableList.copyOf(blockSnapshots);
|
||||
|
||||
@@ -642,33 +642,6 @@ public abstract class BlockFluidBase extends Block implements IFluidBlock
|
||||
return !here.getMaterial().isSolid() && up.getBlock() == this ? 1 : this.getQuantaPercentage(world, pos) * 0.875F;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated we now pass along up from getExtendedState
|
||||
*/
|
||||
@Deprecated
|
||||
public float getFluidHeightForRender(IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
IBlockState here = world.getBlockState(pos);
|
||||
IBlockState up = world.getBlockState(pos.down(densityDir));
|
||||
if (here.getBlock() == this)
|
||||
{
|
||||
if (up.getMaterial().isLiquid() || up.getBlock() instanceof IFluidBlock)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (getMetaFromState(here) == getMaxRenderHeightMeta())
|
||||
{
|
||||
return 0.875F;
|
||||
}
|
||||
}
|
||||
if (here.getBlock() instanceof BlockLiquid)
|
||||
{
|
||||
return Math.min(1 - BlockLiquid.getLiquidHeightPercent(here.getValue(BlockLiquid.LEVEL)), 14f / 16);
|
||||
}
|
||||
return !here.getMaterial().isSolid() && up.getBlock() == this ? 1 : this.getQuantaPercentage(world, pos) * 0.875F;
|
||||
}
|
||||
|
||||
public Vec3d getFlowVector(IBlockAccess world, BlockPos pos)
|
||||
{
|
||||
Vec3d vec = new Vec3d(0.0D, 0.0D, 0.0D);
|
||||
|
||||
@@ -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