Remove some deprecated methods and clean up
This commit is contained in:
parent
7892ca922c
commit
9a09ff68aa
|
@ -171,7 +171,7 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
+ EnumActionResult cancelResult = net.minecraftforge.common.ForgeHooks.onItemRightClickAction(p_187101_1_, p_187101_3_);
|
+ EnumActionResult cancelResult = net.minecraftforge.common.ForgeHooks.onItemRightClick(p_187101_1_, p_187101_3_);
|
||||||
+ if (cancelResult != null) return cancelResult;
|
+ if (cancelResult != null) return cancelResult;
|
||||||
int i = itemstack.func_190916_E();
|
int i = itemstack.func_190916_E();
|
||||||
ActionResult<ItemStack> actionresult = itemstack.func_77957_a(p_187101_2_, p_187101_1_, p_187101_3_);
|
ActionResult<ItemStack> actionresult = itemstack.func_77957_a(p_187101_2_, p_187101_1_, p_187101_3_);
|
||||||
|
@ -192,7 +192,7 @@
|
||||||
Vec3d vec3d = new Vec3d(p_187102_3_.field_72307_f.field_72450_a - p_187102_2_.field_70165_t, p_187102_3_.field_72307_f.field_72448_b - p_187102_2_.field_70163_u, p_187102_3_.field_72307_f.field_72449_c - p_187102_2_.field_70161_v);
|
Vec3d vec3d = new Vec3d(p_187102_3_.field_72307_f.field_72450_a - p_187102_2_.field_70165_t, p_187102_3_.field_72307_f.field_72448_b - p_187102_2_.field_70163_u, p_187102_3_.field_72307_f.field_72449_c - p_187102_2_.field_70161_v);
|
||||||
this.field_78774_b.func_147297_a(new CPacketUseEntity(p_187102_2_, p_187102_4_, vec3d));
|
this.field_78774_b.func_147297_a(new CPacketUseEntity(p_187102_2_, p_187102_4_, vec3d));
|
||||||
+ if (this.field_78779_k == GameType.SPECTATOR) return EnumActionResult.PASS; // don't fire for spectators to match non-specific EntityInteract
|
+ if (this.field_78779_k == GameType.SPECTATOR) return EnumActionResult.PASS; // don't fire for spectators to match non-specific EntityInteract
|
||||||
+ EnumActionResult cancelResult = net.minecraftforge.common.ForgeHooks.onInteractEntityAtAction(p_187102_1_, p_187102_2_, p_187102_3_, p_187102_4_);
|
+ EnumActionResult cancelResult = net.minecraftforge.common.ForgeHooks.onInteractEntityAt(p_187102_1_, p_187102_2_, p_187102_3_, p_187102_4_);
|
||||||
+ if(cancelResult != null) return cancelResult;
|
+ if(cancelResult != null) return cancelResult;
|
||||||
return this.field_78779_k == GameType.SPECTATOR ? EnumActionResult.PASS : p_187102_2_.func_184199_a(p_187102_1_, vec3d, p_187102_4_);
|
return this.field_78779_k == GameType.SPECTATOR ? EnumActionResult.PASS : p_187102_2_.func_184199_a(p_187102_1_, vec3d, p_187102_4_);
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@
|
||||||
int i = itemstack.func_190916_E();
|
int i = itemstack.func_190916_E();
|
||||||
|
|
||||||
- if (this.field_145804_b == 0 && (this.field_145802_g == null || 6000 - this.field_70292_b <= 200 || this.field_145802_g.equals(p_70100_1_.func_70005_c_())) && p_70100_1_.field_71071_by.func_70441_a(itemstack))
|
- if (this.field_145804_b == 0 && (this.field_145802_g == null || 6000 - this.field_70292_b <= 200 || this.field_145802_g.equals(p_70100_1_.func_70005_c_())) && p_70100_1_.field_71071_by.func_70441_a(itemstack))
|
||||||
+ int hook = net.minecraftforge.event.ForgeEventFactory.onItemPickup(this, p_70100_1_, itemstack);
|
+ int hook = net.minecraftforge.event.ForgeEventFactory.onItemPickup(this, p_70100_1_);
|
||||||
+ if (hook < 0) return;
|
+ if (hook < 0) return;
|
||||||
+
|
+
|
||||||
+ if (this.field_145804_b <= 0 && (this.field_145802_g == null || lifespan - this.field_70292_b <= 200 || this.field_145802_g.equals(p_70100_1_.func_70005_c_())) && (hook == 1 || i <= 0 || p_70100_1_.field_71071_by.func_70441_a(itemstack)))
|
+ if (this.field_145804_b <= 0 && (this.field_145802_g == null || lifespan - this.field_70292_b <= 200 || this.field_145802_g.equals(p_70100_1_.func_70005_c_())) && (hook == 1 || i <= 0 || p_70100_1_.field_71071_by.func_70441_a(itemstack)))
|
||||||
|
|
|
@ -228,7 +228,7 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
+ EnumActionResult cancelResult = net.minecraftforge.common.ForgeHooks.onInteractEntityAction(this, p_190775_1_, p_190775_2_);
|
+ EnumActionResult cancelResult = net.minecraftforge.common.ForgeHooks.onInteractEntity(this, p_190775_1_, p_190775_2_);
|
||||||
+ if (cancelResult != null) return cancelResult;
|
+ if (cancelResult != null) return cancelResult;
|
||||||
ItemStack itemstack = this.func_184586_b(p_190775_2_);
|
ItemStack itemstack = this.func_184586_b(p_190775_2_);
|
||||||
ItemStack itemstack1 = itemstack.func_190926_b() ? ItemStack.field_190927_a : itemstack.func_77946_l();
|
ItemStack itemstack1 = itemstack.func_190926_b() ? ItemStack.field_190927_a : itemstack.func_77946_l();
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
p_180614_2_.func_180501_a(p_180614_3_, iblockstate1, 10);
|
p_180614_2_.func_180501_a(p_180614_3_, iblockstate1, 10);
|
||||||
|
|
||||||
if (!p_180614_1_.field_71075_bZ.field_75098_d)
|
if (!p_180614_1_.field_71075_bZ.field_75098_d)
|
||||||
@@ -99,8 +99,27 @@
|
@@ -99,8 +99,18 @@
|
||||||
|
|
||||||
public static boolean func_179234_a(ItemStack p_179234_0_, World p_179234_1_, BlockPos p_179234_2_)
|
public static boolean func_179234_a(ItemStack p_179234_0_, World p_179234_1_, BlockPos p_179234_2_)
|
||||||
{
|
{
|
||||||
|
@ -27,15 +27,6 @@
|
||||||
+ return false;
|
+ return false;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
|
||||||
+ * @deprecated Use {@link #applyBonemeal(ItemStack, World, BlockPos, EntityPlayer, EnumHand)} instead.
|
|
||||||
+ */
|
|
||||||
+ @Deprecated
|
|
||||||
+ public static boolean applyBonemeal(ItemStack p_179234_0_, World p_179234_1_, BlockPos p_179234_2_, EntityPlayer player)
|
|
||||||
+ {
|
|
||||||
+ return applyBonemeal(p_179234_0_, p_179234_1_, p_179234_2_, player, null);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ public static boolean applyBonemeal(ItemStack p_179234_0_, World p_179234_1_, BlockPos p_179234_2_, EntityPlayer player, @javax.annotation.Nullable EnumHand hand)
|
+ public static boolean applyBonemeal(ItemStack p_179234_0_, World p_179234_1_, BlockPos p_179234_2_, EntityPlayer player, @javax.annotation.Nullable EnumHand hand)
|
||||||
+ {
|
+ {
|
||||||
IBlockState iblockstate = p_179234_1_.func_180495_p(p_179234_2_);
|
IBlockState iblockstate = p_179234_1_.func_180495_p(p_179234_2_);
|
||||||
|
@ -46,7 +37,7 @@
|
||||||
if (iblockstate.func_177230_c() instanceof IGrowable)
|
if (iblockstate.func_177230_c() instanceof IGrowable)
|
||||||
{
|
{
|
||||||
IGrowable igrowable = (IGrowable)iblockstate.func_177230_c();
|
IGrowable igrowable = (IGrowable)iblockstate.func_177230_c();
|
||||||
@@ -144,6 +163,16 @@
|
@@ -144,6 +154,16 @@
|
||||||
p_180617_0_.func_175688_a(EnumParticleTypes.VILLAGER_HAPPY, (double)((float)p_180617_1_.func_177958_n() + field_77697_d.nextFloat()), (double)p_180617_1_.func_177956_o() + (double)field_77697_d.nextFloat() * iblockstate.func_185900_c(p_180617_0_, p_180617_1_).field_72337_e, (double)((float)p_180617_1_.func_177952_p() + field_77697_d.nextFloat()), d0, d1, d2);
|
p_180617_0_.func_175688_a(EnumParticleTypes.VILLAGER_HAPPY, (double)((float)p_180617_1_.func_177958_n() + field_77697_d.nextFloat()), (double)p_180617_1_.func_177956_o() + (double)field_77697_d.nextFloat() * iblockstate.func_185900_c(p_180617_0_, p_180617_1_).field_72337_e, (double)((float)p_180617_1_.func_177952_p() + field_77697_d.nextFloat()), d0, d1, d2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -294,7 +294,7 @@
|
||||||
+ {
|
+ {
|
||||||
+ this.delegate = item.delegate;
|
+ this.delegate = item.delegate;
|
||||||
+ net.minecraftforge.common.capabilities.ICapabilityProvider provider = item.initCapabilities(this, this.capNBT);
|
+ net.minecraftforge.common.capabilities.ICapabilityProvider provider = item.initCapabilities(this, this.capNBT);
|
||||||
+ this.capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(item, this, provider);
|
+ this.capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(this, provider);
|
||||||
+ if (this.capNBT != null && this.capabilities != null) this.capabilities.deserializeNBT(this.capNBT);
|
+ if (this.capNBT != null && this.capabilities != null) this.capabilities.deserializeNBT(this.capNBT);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
else if (p_147340_1_.func_149565_c() == CPacketUseEntity.Action.INTERACT_AT)
|
else if (p_147340_1_.func_149565_c() == CPacketUseEntity.Action.INTERACT_AT)
|
||||||
{
|
{
|
||||||
EnumHand enumhand1 = p_147340_1_.func_186994_b();
|
EnumHand enumhand1 = p_147340_1_.func_186994_b();
|
||||||
+ if(net.minecraftforge.common.ForgeHooks.onInteractEntityAtAction(field_147369_b, entity, p_147340_1_.func_179712_b(), enumhand1) != null) return;
|
+ if(net.minecraftforge.common.ForgeHooks.onInteractEntityAt(field_147369_b, entity, p_147340_1_.func_179712_b(), enumhand1) != null) return;
|
||||||
entity.func_184199_a(this.field_147369_b, p_147340_1_.func_179712_b(), enumhand1);
|
entity.func_184199_a(this.field_147369_b, p_147340_1_.func_179712_b(), enumhand1);
|
||||||
}
|
}
|
||||||
else if (p_147340_1_.func_149565_c() == CPacketUseEntity.Action.ATTACK)
|
else if (p_147340_1_.func_149565_c() == CPacketUseEntity.Action.ATTACK)
|
||||||
|
|
|
@ -204,7 +204,7 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
+ EnumActionResult cancelResult = net.minecraftforge.common.ForgeHooks.onItemRightClickAction(p_187250_1_, p_187250_4_);
|
+ EnumActionResult cancelResult = net.minecraftforge.common.ForgeHooks.onItemRightClick(p_187250_1_, p_187250_4_);
|
||||||
+ if (cancelResult != null) return cancelResult;
|
+ if (cancelResult != null) return cancelResult;
|
||||||
int i = p_187250_3_.func_190916_E();
|
int i = p_187250_3_.func_190916_E();
|
||||||
int j = p_187250_3_.func_77960_j();
|
int j = p_187250_3_.func_77960_j();
|
||||||
|
|
|
@ -105,15 +105,9 @@ public class ForgeGuiFactory implements IModGuiFactory
|
||||||
@Override
|
@Override
|
||||||
public GuiScreen createConfigGui(GuiScreen parent) { return new ForgeConfigGui(parent); }
|
public GuiScreen createConfigGui(GuiScreen parent) { return new ForgeConfigGui(parent); }
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<? extends GuiScreen> mainConfigGuiClass() { return null; }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() { return null; }
|
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() { return null; }
|
||||||
|
|
||||||
@Override
|
|
||||||
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) { return null; }
|
|
||||||
|
|
||||||
public static class ForgeConfigGui extends GuiConfig
|
public static class ForgeConfigGui extends GuiConfig
|
||||||
{
|
{
|
||||||
public ForgeConfigGui(GuiScreen parentScreen)
|
public ForgeConfigGui(GuiScreen parentScreen)
|
||||||
|
|
|
@ -19,12 +19,10 @@
|
||||||
|
|
||||||
package net.minecraftforge.client.model.pipeline;
|
package net.minecraftforge.client.model.pipeline;
|
||||||
|
|
||||||
import net.minecraft.block.Block.EnumOffsetType;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.renderer.color.BlockColors;
|
import net.minecraft.client.renderer.color.BlockColors;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
|
||||||
|
|
|
@ -62,14 +62,6 @@ public class DungeonHooks
|
||||||
return rarity;
|
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.
|
* Will completely remove a Mob from the dungeon spawn list.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1032,52 +1032,27 @@ public class ForgeHooks
|
||||||
return git == null ? null : git.hitVec;
|
return git == null ? null : git.hitVec;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO 1.12 remove these three
|
public static EnumActionResult onInteractEntityAt(EntityPlayer player, Entity entity, RayTraceResult ray, EnumHand hand)
|
||||||
@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)
|
|
||||||
{
|
{
|
||||||
Vec3d vec3d = new Vec3d(ray.hitVec.x - entity.posX, ray.hitVec.y - entity.posY, ray.hitVec.z - entity.posZ);
|
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);
|
PlayerInteractEvent.EntityInteractSpecific evt = new PlayerInteractEvent.EntityInteractSpecific(player, hand, entity, vec3d);
|
||||||
MinecraftForge.EVENT_BUS.post(evt);
|
MinecraftForge.EVENT_BUS.post(evt);
|
||||||
return evt.isCanceled() ? evt.getCancellationResult() : null;
|
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);
|
PlayerInteractEvent.EntityInteract evt = new PlayerInteractEvent.EntityInteract(player, hand, entity);
|
||||||
MinecraftForge.EVENT_BUS.post(evt);
|
MinecraftForge.EVENT_BUS.post(evt);
|
||||||
return evt.isCanceled() ? evt.getCancellationResult() : null;
|
return evt.isCanceled() ? evt.getCancellationResult() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated // TODO 1.12 remove
|
public static EnumActionResult onItemRightClick(EntityPlayer player, EnumHand hand)
|
||||||
public static boolean onItemRightClick(EntityPlayer player, EnumHand hand)
|
|
||||||
{
|
|
||||||
return onItemRightClickAction(player, hand) != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static EnumActionResult onItemRightClickAction(EntityPlayer player, EnumHand hand)
|
|
||||||
{
|
{
|
||||||
PlayerInteractEvent.RightClickItem evt = new PlayerInteractEvent.RightClickItem(player, hand);
|
PlayerInteractEvent.RightClickItem evt = new PlayerInteractEvent.RightClickItem(player, hand);
|
||||||
MinecraftForge.EVENT_BUS.post(evt);
|
MinecraftForge.EVENT_BUS.post(evt);
|
||||||
|
@ -1108,14 +1083,6 @@ public class ForgeHooks
|
||||||
MinecraftForge.EVENT_BUS.post(new PlayerInteractEvent.LeftClickEmpty(player));
|
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 ThreadLocal<Deque<LootTableContext>> lootContext = new ThreadLocal<Deque<LootTableContext>>();
|
||||||
private static LootTableContext getLootTableContext()
|
private static LootTableContext getLootTableContext()
|
||||||
{
|
{
|
||||||
|
@ -1127,14 +1094,6 @@ public class ForgeHooks
|
||||||
return ctx;
|
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
|
@Nullable
|
||||||
public static LootTable loadLootTable(Gson gson, ResourceLocation name, String data, boolean custom, LootTableManager lootTableManager)
|
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.common.capabilities.ICapabilityProvider;
|
||||||
import net.minecraftforge.fml.common.eventhandler.GenericEvent;
|
import net.minecraftforge.fml.common.eventhandler.GenericEvent;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fired whenever an object with Capabilities support {currently TileEntity/Item/Entity)
|
* Fired whenever an object with Capabilities support {currently TileEntity/Item/Entity)
|
||||||
* is created. Allowing for the attachment of arbitrary capability providers.
|
* 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>
|
public class AttachCapabilitiesEvent<T> extends GenericEvent<T>
|
||||||
{
|
{
|
||||||
private final T obj;
|
private final T obj;
|
||||||
final Map<ResourceLocation, ICapabilityProvider> caps;// package-private for ForgeEventFactory
|
private final Map<ResourceLocation, ICapabilityProvider> caps = Maps.newLinkedHashMap();
|
||||||
private final Map<ResourceLocation, ICapabilityProvider> view;
|
private final Map<ResourceLocation, ICapabilityProvider> view = Collections.unmodifiableMap(caps);
|
||||||
|
|
||||||
public AttachCapabilitiesEvent(Class<T> type, T obj)
|
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);
|
super(type);
|
||||||
this.obj = obj;
|
this.obj = obj;
|
||||||
this.caps = caps;
|
|
||||||
this.view = Collections.unmodifiableMap(caps);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -86,22 +77,4 @@ public class AttachCapabilitiesEvent<T> extends GenericEvent<T>
|
||||||
{
|
{
|
||||||
return view;
|
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.io.File;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import com.google.common.base.Predicate;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.util.ITooltipFlag;
|
import net.minecraft.client.util.ITooltipFlag;
|
||||||
import net.minecraft.command.ICommandSender;
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLiving;
|
import net.minecraft.entity.EntityLiving;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
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;
|
||||||
import net.minecraft.entity.player.EntityPlayer.SleepResult;
|
import net.minecraft.entity.player.EntityPlayer.SleepResult;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.ActionResult;
|
import net.minecraft.util.ActionResult;
|
||||||
|
@ -54,7 +50,6 @@ import net.minecraft.util.SoundCategory;
|
||||||
import net.minecraft.util.SoundEvent;
|
import net.minecraft.util.SoundEvent;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
import net.minecraft.util.math.Vec3d;
|
|
||||||
import net.minecraft.util.text.ChatType;
|
import net.minecraft.util.text.ChatType;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.village.Village;
|
import net.minecraft.village.Village;
|
||||||
|
@ -127,7 +122,7 @@ import javax.annotation.Nullable;
|
||||||
public class ForgeEventFactory
|
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);
|
BlockSnapshot snap = blockSnapshots.get(0);
|
||||||
IBlockState placedAgainst = snap.getWorld().getBlockState(snap.getPos().offset(direction.getOpposite()));
|
IBlockState placedAgainst = snap.getWorld().getBlockState(snap.getPos().offset(direction.getOpposite()));
|
||||||
|
@ -400,9 +395,9 @@ public class ForgeEventFactory
|
||||||
return event.getExtraLife();
|
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;
|
if (MinecraftForge.EVENT_BUS.post(event)) return -1;
|
||||||
return event.getResult() == Result.ALLOW ? 1 : 0;
|
return event.getResult() == Result.ALLOW ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
@ -561,15 +556,9 @@ public class ForgeEventFactory
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static CapabilityDispatcher gatherCapabilities(Item item, ItemStack stack, ICapabilityProvider parent)
|
public static CapabilityDispatcher gatherCapabilities(ItemStack stack, ICapabilityProvider parent)
|
||||||
{
|
{
|
||||||
// first fire the legacy event
|
return gatherCapabilities(new AttachCapabilitiesEvent<ItemStack>(ItemStack.class, stack), parent);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
|
@ -41,14 +41,6 @@ public class LootTableLoadEvent extends Event
|
||||||
private LootTable table;
|
private LootTable table;
|
||||||
private LootTableManager lootTableManager;
|
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)
|
public LootTableLoadEvent(ResourceLocation name, LootTable table, LootTableManager lootTableManager)
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
|
@ -51,15 +51,6 @@ public class BonemealEvent extends PlayerEvent
|
||||||
private final EnumHand hand;
|
private final EnumHand hand;
|
||||||
private final ItemStack stack;
|
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,
|
public BonemealEvent(@Nonnull EntityPlayer player, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState block, @Nullable EnumHand hand,
|
||||||
@Nonnull ItemStack stack)
|
@Nonnull ItemStack stack)
|
||||||
{
|
{
|
||||||
|
|
|
@ -318,14 +318,6 @@ public class PlayerInteractEvent extends PlayerEvent
|
||||||
{
|
{
|
||||||
super(player, EnumHand.MAIN_HAND, new BlockPos(player), null);
|
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.common.util.BlockSnapshot;
|
||||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
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 com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
public class BlockEvent extends Event
|
public class BlockEvent extends Event
|
||||||
{
|
{
|
||||||
|
@ -177,12 +174,6 @@ public class BlockEvent extends Event
|
||||||
private final IBlockState placedAgainst;
|
private final IBlockState placedAgainst;
|
||||||
private final EnumHand hand;
|
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) {
|
public PlaceEvent(@Nonnull BlockSnapshot blockSnapshot, @Nonnull IBlockState placedAgainst, @Nonnull EntityPlayer player, @Nonnull EnumHand hand) {
|
||||||
super(blockSnapshot.getWorld(), blockSnapshot.getPos(), blockSnapshot.getCurrentBlock());
|
super(blockSnapshot.getWorld(), blockSnapshot.getPos(), blockSnapshot.getCurrentBlock());
|
||||||
this.player = player;
|
this.player = player;
|
||||||
|
@ -218,12 +209,6 @@ public class BlockEvent extends Event
|
||||||
{
|
{
|
||||||
private final List<BlockSnapshot> blockSnapshots;
|
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) {
|
public MultiPlaceEvent(@Nonnull List<BlockSnapshot> blockSnapshots, @Nonnull IBlockState placedAgainst, @Nonnull EntityPlayer player, @Nonnull EnumHand hand) {
|
||||||
super(blockSnapshots.get(0), placedAgainst, player, hand);
|
super(blockSnapshots.get(0), placedAgainst, player, hand);
|
||||||
this.blockSnapshots = ImmutableList.copyOf(blockSnapshots);
|
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;
|
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)
|
public Vec3d getFlowVector(IBlockAccess world, BlockPos pos)
|
||||||
{
|
{
|
||||||
Vec3d vec = new Vec3d(0.0D, 0.0D, 0.0D);
|
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;
|
package net.minecraftforge.fml.client;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -37,25 +56,12 @@ public class DefaultGuiFactory implements IModGuiFactory
|
||||||
return new GuiConfig(parentScreen, modid, title);
|
return new GuiConfig(parentScreen, modid, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
@Override
|
|
||||||
public Class<? extends GuiScreen> mainConfigGuiClass()
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories()
|
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories()
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IModGuiFactory forMod(ModContainer mod)
|
public static IModGuiFactory forMod(ModContainer mod)
|
||||||
{
|
{
|
||||||
return new DefaultGuiFactory(mod.getModId(), mod.getName());
|
return new DefaultGuiFactory(mod.getModId(), mod.getName());
|
||||||
|
|
|
@ -27,8 +27,6 @@ import java.util.regex.Pattern;
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
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.gui.GuiScreen;
|
||||||
import net.minecraft.client.resources.I18n;
|
import net.minecraft.client.resources.I18n;
|
||||||
import net.minecraftforge.fml.client.config.ConfigGuiType;
|
import net.minecraftforge.fml.client.config.ConfigGuiType;
|
||||||
|
@ -141,12 +139,6 @@ public class FMLConfigGuiFactory implements IModGuiFactory
|
||||||
return new FMLConfigGuiScreen(parentScreen);
|
return new FMLConfigGuiScreen(parentScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<? extends GuiScreen> mainConfigGuiClass()
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Set<RuntimeOptionCategoryElement> fmlCategories = ImmutableSet.of(new RuntimeOptionCategoryElement("HELP", "FML"));
|
private static final Set<RuntimeOptionCategoryElement> fmlCategories = ImmutableSet.of(new RuntimeOptionCategoryElement("HELP", "FML"));
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -154,36 +146,4 @@ public class FMLConfigGuiFactory implements IModGuiFactory
|
||||||
{
|
{
|
||||||
return fmlCategories;
|
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
|
try
|
||||||
{
|
{
|
||||||
IModGuiFactory guiFactory = FMLClientHandler.instance().getGuiFactoryFor(selectedMod);
|
IModGuiFactory guiFactory = FMLClientHandler.instance().getGuiFactoryFor(selectedMod);
|
||||||
GuiScreen newScreen = null;
|
GuiScreen newScreen = guiFactory.createConfigGui(this);
|
||||||
try
|
|
||||||
{
|
|
||||||
newScreen = guiFactory.createConfigGui(this);
|
|
||||||
}
|
|
||||||
catch (AbstractMethodError error)
|
|
||||||
{
|
|
||||||
newScreen = guiFactory.mainConfigGuiClass().getConstructor(GuiScreen.class).newInstance(this);
|
|
||||||
}
|
|
||||||
this.mc.displayGuiScreen(newScreen);
|
this.mc.displayGuiScreen(newScreen);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -424,16 +416,9 @@ public class GuiModList extends GuiScreen
|
||||||
configModButton.visible = true;
|
configModButton.visible = true;
|
||||||
configModButton.enabled = false;
|
configModButton.enabled = false;
|
||||||
if (guiFactory != null)
|
if (guiFactory != null)
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
configModButton.enabled = guiFactory.hasConfigGui();
|
configModButton.enabled = guiFactory.hasConfigGui();
|
||||||
}
|
}
|
||||||
catch(AbstractMethodError error)
|
|
||||||
{
|
|
||||||
configModButton.enabled = guiFactory.mainConfigGuiClass() != null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lines.add(selectedMod.getMetadata().name);
|
lines.add(selectedMod.getMetadata().name);
|
||||||
lines.add(String.format("Version: %s (%s)", selectedMod.getDisplayVersion(), selectedMod.getVersion()));
|
lines.add(String.format("Version: %s (%s)", selectedMod.getDisplayVersion(), selectedMod.getVersion()));
|
||||||
lines.add(String.format("Mod ID: '%s' Mod State: %s", selectedMod.getModId(), Loader.instance().getModState(selectedMod)));
|
lines.add(String.format("Mod ID: '%s' Mod State: %s", selectedMod.getModId(), Loader.instance().getModState(selectedMod)));
|
||||||
|
|
|
@ -19,14 +19,10 @@
|
||||||
|
|
||||||
package net.minecraftforge.fml.client;
|
package net.minecraftforge.fml.client;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.Gui;
|
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
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.
|
* 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
|
* {@link DefaultGuiFactory} provides a default implementation of this interface and will be used
|
||||||
|
@ -68,31 +64,6 @@ public interface IModGuiFactory {
|
||||||
*/
|
*/
|
||||||
public GuiScreen createConfigGui(GuiScreen parentScreen);
|
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
|
* Return a list of the "runtime" categories this mod wishes to populate with
|
||||||
* GUI elements.
|
* GUI elements.
|
||||||
|
@ -115,16 +86,6 @@ public interface IModGuiFactory {
|
||||||
*/
|
*/
|
||||||
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories();
|
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.
|
* Represents an option category and entry in the runtime gui options list.
|
||||||
*
|
*
|
||||||
|
@ -141,48 +102,4 @@ public interface IModGuiFactory {
|
||||||
this.child = child;
|
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.JarEntry;
|
||||||
import java.util.jar.JarFile;
|
import java.util.jar.JarFile;
|
||||||
|
|
||||||
import net.minecraftforge.common.util.Java6Utils;
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
|
||||||
import net.minecraft.launchwrapper.LaunchClassLoader;
|
import net.minecraft.launchwrapper.LaunchClassLoader;
|
||||||
|
@ -146,7 +145,7 @@ public class FMLSanityChecker implements IFMLCallHook
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Java6Utils.closeZipQuietly(mcJarFile);
|
IOUtils.closeQuietly(mcJarFile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -24,7 +24,6 @@ import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.jar.JarFile;
|
import java.util.jar.JarFile;
|
||||||
|
|
||||||
import net.minecraftforge.common.util.Java6Utils;
|
|
||||||
import net.minecraftforge.fml.common.FMLLog;
|
import net.minecraftforge.fml.common.FMLLog;
|
||||||
import net.minecraftforge.fml.common.LoaderException;
|
import net.minecraftforge.fml.common.LoaderException;
|
||||||
import net.minecraftforge.fml.common.MetadataCollection;
|
import net.minecraftforge.fml.common.MetadataCollection;
|
||||||
|
@ -120,7 +119,7 @@ public class JarDiscoverer implements ITypeDiscoverer
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
Java6Utils.closeZipQuietly(jar);
|
IOUtils.closeQuietly(jar);
|
||||||
}
|
}
|
||||||
return foundMods;
|
return foundMods;
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,29 +180,6 @@ public class ReflectionHelper
|
||||||
throw new UnableToFindClassException(classNames, err);
|
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.
|
* 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.
|
* 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.util.text.translation.LanguageMap;
|
||||||
import net.minecraft.world.storage.SaveFormatOld;
|
import net.minecraft.world.storage.SaveFormatOld;
|
||||||
import net.minecraftforge.common.util.CompoundDataFixer;
|
import net.minecraftforge.common.util.CompoundDataFixer;
|
||||||
import net.minecraftforge.common.util.Java6Utils;
|
|
||||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||||
import net.minecraftforge.fml.common.FMLLog;
|
import net.minecraftforge.fml.common.FMLLog;
|
||||||
import net.minecraftforge.fml.common.IFMLSidedHandler;
|
import net.minecraftforge.fml.common.IFMLSidedHandler;
|
||||||
|
@ -277,7 +276,7 @@ public class FMLServerHandler implements IFMLSidedHandler
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
IOUtils.closeQuietly(stream);
|
IOUtils.closeQuietly(stream);
|
||||||
Java6Utils.closeZipQuietly(zip);
|
IOUtils.closeQuietly(zip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ package net.minecraftforge.debug;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTBase;
|
import net.minecraft.nbt.NBTBase;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
@ -189,26 +188,6 @@ public class TestCapabilityMod
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// these can be removed if we remove these legacy events
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onItemLoadLegacy(AttachCapabilitiesEvent<Item> event)
|
|
||||||
{
|
|
||||||
if (event.getObject() == Items.APPLE)
|
|
||||||
{
|
|
||||||
event.addCapability(new ResourceLocation("forge.testcapmod:dummy_cap"), new Provider<Item>(event.getObject()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void onItemLoadLegacy(AttachCapabilitiesEvent.Item event)
|
|
||||||
{
|
|
||||||
if (event.getObject() == Items.ARROW)
|
|
||||||
{
|
|
||||||
event.addCapability(new ResourceLocation("forge.testcapmod:dummy_cap"), new Provider<Item>(event.getObject()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void attachEvent(AttachCapabilitiesEvent event) //Test Raw type gets everything still.
|
public void attachEvent(AttachCapabilitiesEvent event) //Test Raw type gets everything still.
|
||||||
|
|
Loading…
Reference in New Issue