2015-11-09 06:50:45 +00:00
--- ../src-base/minecraft/net/minecraft/entity/EntityLivingBase.java
+++ ../src-work/minecraft/net/minecraft/entity/EntityLivingBase.java
2016-11-13 22:09:54 +00:00
@@ -199,10 +199,11 @@
2016-03-30 22:59:14 +00:00
{
2016-03-12 00:59:24 +00:00
float f = (float)MathHelper.func_76123_f(this.field_70143_R - 3.0F);
2015-12-13 21:35:15 +00:00
2016-03-30 22:59:14 +00:00
- if (p_184231_4_.func_185904_a() != Material.field_151579_a)
+ if (!p_184231_4_.func_177230_c().isAir(p_184231_4_, field_70170_p, p_184231_5_))
2016-03-12 00:59:24 +00:00
{
double d0 = Math.min((double)(0.2F + f / 15.0F), 2.5D);
2015-12-13 21:35:15 +00:00
int i = (int)(150.0D * d0);
2016-03-12 00:59:24 +00:00
+ if (!p_184231_4_.func_177230_c().addLandingEffects(p_184231_4_, (WorldServer)this.field_70170_p, p_184231_5_, p_184231_4_, this, i))
((WorldServer)this.field_70170_p).func_175739_a(EnumParticleTypes.BLOCK_DUST, this.field_70165_t, this.field_70163_u, this.field_70161_v, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, new int[] {Block.func_176210_f(p_184231_4_)});
2015-12-13 21:35:15 +00:00
}
}
2016-11-13 22:09:54 +00:00
@@ -279,7 +280,7 @@
LoadingScreenRenderer,Minecraft,GuiContainerCreative,PlayerControllerMP,LanguageManager,Locale,SimpleReloadableResourceManager,EntityList,EntityLivingBase,EntityWither,EntityMinecart,EntityPlayerMP
NethanlderPlayClient patch is now in vanilla. The FMLCommonHandler future exception catcher is not needed anymore, it's in Util. The caching of player profiles is now in vanilla (SkinManager).
2015-11-11 15:33:37 +00:00
}
}
2016-03-12 00:59:24 +00:00
- if (!this.field_70170_p.field_72995_K && this.func_184218_aH() && this.func_184187_bx() instanceof EntityLivingBase)
+ if (!this.field_70170_p.field_72995_K && this.func_184218_aH() && this.func_184187_bx() != null && this.func_184187_bx().shouldDismountInWater(this))
LoadingScreenRenderer,Minecraft,GuiContainerCreative,PlayerControllerMP,LanguageManager,Locale,SimpleReloadableResourceManager,EntityList,EntityLivingBase,EntityWither,EntityMinecart,EntityPlayerMP
NethanlderPlayClient patch is now in vanilla. The FMLCommonHandler future exception catcher is not needed anymore, it's in Util. The caching of player profiles is now in vanilla (SkinManager).
2015-11-11 15:33:37 +00:00
{
2016-03-12 00:59:24 +00:00
this.func_184210_p();
LoadingScreenRenderer,Minecraft,GuiContainerCreative,PlayerControllerMP,LanguageManager,Locale,SimpleReloadableResourceManager,EntityList,EntityLivingBase,EntityWither,EntityMinecart,EntityPlayerMP
NethanlderPlayClient patch is now in vanilla. The FMLCommonHandler future exception catcher is not needed anymore, it's in Util. The caching of player profiles is now in vanilla (SkinManager).
2015-11-11 15:33:37 +00:00
}
2016-11-13 22:09:54 +00:00
@@ -378,7 +379,7 @@
2016-03-12 00:59:24 +00:00
if (!this.field_70170_p.field_72995_K && (this.func_70684_aJ() || this.field_70718_bc > 0 && this.func_146066_aG() && this.field_70170_p.func_82736_K().func_82766_b("doMobLoot")))
LoadingScreenRenderer,Minecraft,GuiContainerCreative,PlayerControllerMP,LanguageManager,Locale,SimpleReloadableResourceManager,EntityList,EntityLivingBase,EntityWither,EntityMinecart,EntityPlayerMP
NethanlderPlayClient patch is now in vanilla. The FMLCommonHandler future exception catcher is not needed anymore, it's in Util. The caching of player profiles is now in vanilla (SkinManager).
2015-11-11 15:33:37 +00:00
{
2015-11-22 05:46:26 +00:00
int i = this.func_70693_a(this.field_70717_bb);
LoadingScreenRenderer,Minecraft,GuiContainerCreative,PlayerControllerMP,LanguageManager,Locale,SimpleReloadableResourceManager,EntityList,EntityLivingBase,EntityWither,EntityMinecart,EntityPlayerMP
NethanlderPlayClient patch is now in vanilla. The FMLCommonHandler future exception catcher is not needed anymore, it's in Util. The caching of player profiles is now in vanilla (SkinManager).
2015-11-11 15:33:37 +00:00
-
2015-11-22 05:46:26 +00:00
+ i = net.minecraftforge.event.ForgeEventFactory.getExperienceDrop(this, this.field_70717_bb, i);
LoadingScreenRenderer,Minecraft,GuiContainerCreative,PlayerControllerMP,LanguageManager,Locale,SimpleReloadableResourceManager,EntityList,EntityLivingBase,EntityWither,EntityMinecart,EntityPlayerMP
NethanlderPlayClient patch is now in vanilla. The FMLCommonHandler future exception catcher is not needed anymore, it's in Util. The caching of player profiles is now in vanilla (SkinManager).
2015-11-11 15:33:37 +00:00
while (i > 0)
{
2015-11-22 05:46:26 +00:00
int j = EntityXPOrb.func_70527_a(i);
2016-11-13 22:09:54 +00:00
@@ -440,6 +441,7 @@
2015-11-09 06:50:45 +00:00
{
2015-11-22 05:46:26 +00:00
this.field_70755_b = p_70604_1_;
this.field_70756_c = this.field_70173_aa;
+ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, p_70604_1_);
2015-11-09 06:50:45 +00:00
}
2015-11-22 05:46:26 +00:00
public EntityLivingBase func_110144_aD()
2016-11-13 22:09:54 +00:00
@@ -812,6 +814,8 @@
LoadingScreenRenderer,Minecraft,GuiContainerCreative,PlayerControllerMP,LanguageManager,Locale,SimpleReloadableResourceManager,EntityList,EntityLivingBase,EntityWither,EntityMinecart,EntityPlayerMP
NethanlderPlayClient patch is now in vanilla. The FMLCommonHandler future exception catcher is not needed anymore, it's in Util. The caching of player profiles is now in vanilla (SkinManager).
2015-11-11 15:33:37 +00:00
2015-11-22 05:46:26 +00:00
public void func_70691_i(float p_70691_1_)
LoadingScreenRenderer,Minecraft,GuiContainerCreative,PlayerControllerMP,LanguageManager,Locale,SimpleReloadableResourceManager,EntityList,EntityLivingBase,EntityWither,EntityMinecart,EntityPlayerMP
NethanlderPlayClient patch is now in vanilla. The FMLCommonHandler future exception catcher is not needed anymore, it's in Util. The caching of player profiles is now in vanilla (SkinManager).
2015-11-11 15:33:37 +00:00
{
2015-11-22 05:46:26 +00:00
+ p_70691_1_ = net.minecraftforge.event.ForgeEventFactory.onLivingHeal(this, p_70691_1_);
+ if (p_70691_1_ <= 0) return;
float f = this.func_110143_aJ();
LoadingScreenRenderer,Minecraft,GuiContainerCreative,PlayerControllerMP,LanguageManager,Locale,SimpleReloadableResourceManager,EntityList,EntityLivingBase,EntityWither,EntityMinecart,EntityPlayerMP
NethanlderPlayClient patch is now in vanilla. The FMLCommonHandler future exception catcher is not needed anymore, it's in Util. The caching of player profiles is now in vanilla (SkinManager).
2015-11-11 15:33:37 +00:00
if (f > 0.0F)
2016-11-13 22:09:54 +00:00
@@ -832,6 +836,7 @@
2015-11-09 06:50:45 +00:00
2015-11-22 05:46:26 +00:00
public boolean func_70097_a(DamageSource p_70097_1_, float p_70097_2_)
2015-11-09 06:50:45 +00:00
{
2015-11-22 05:46:26 +00:00
+ if (!net.minecraftforge.common.ForgeHooks.onLivingAttack(this, p_70097_1_, p_70097_2_)) return false;
if (this.func_180431_b(p_70097_1_))
2015-11-09 06:50:45 +00:00
{
return false;
2016-11-13 22:09:54 +00:00
@@ -918,9 +923,9 @@
2015-11-22 05:46:26 +00:00
this.field_70718_bc = 100;
2016-11-13 22:09:54 +00:00
this.field_70717_bb = (EntityPlayer)entity1;
2015-11-09 06:50:45 +00:00
}
2016-11-13 22:09:54 +00:00
- else if (entity1 instanceof EntityWolf)
+ else if (entity1 instanceof net.minecraft.entity.passive.EntityTameable)
2015-11-09 06:50:45 +00:00
{
2016-11-13 22:09:54 +00:00
- EntityWolf entitywolf = (EntityWolf)entity1;
+ net.minecraft.entity.passive.EntityTameable entitywolf = (net.minecraft.entity.passive.EntityTameable)entity1;
2015-11-09 06:50:45 +00:00
2015-11-22 05:46:26 +00:00
if (entitywolf.func_70909_n())
2015-11-09 06:50:45 +00:00
{
2016-11-13 22:09:54 +00:00
@@ -1107,6 +1112,7 @@
2015-11-09 06:50:45 +00:00
2015-11-22 05:46:26 +00:00
public void func_70645_a(DamageSource p_70645_1_)
2015-11-09 06:50:45 +00:00
{
2015-11-22 05:46:26 +00:00
+ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_70645_1_)) return;
2016-03-12 00:59:24 +00:00
if (!this.field_70729_aU)
{
Entity entity = p_70645_1_.func_76346_g();
2016-11-13 22:09:54 +00:00
@@ -1127,18 +1133,26 @@
2015-11-09 06:50:45 +00:00
2016-10-30 15:53:50 +00:00
if (!this.field_70170_p.field_72995_K)
{
- int i = 0;
+ int i = net.minecraftforge.common.ForgeHooks.getLootingLevel(this, entity, p_70645_1_);
- if (entity instanceof EntityPlayer)
- {
- i = EnchantmentHelper.func_185283_h((EntityLivingBase)entity);
- }
2016-03-12 00:59:24 +00:00
+ captureDrops = true;
+ capturedDrops.clear();
2016-10-30 15:53:50 +00:00
2016-03-12 00:59:24 +00:00
if (this.func_146066_aG() && this.field_70170_p.func_82736_K().func_82766_b("doMobLoot"))
{
boolean flag = this.field_70718_bc > 0;
this.func_184610_a(flag, i, p_70645_1_);
2015-11-09 06:50:45 +00:00
}
+
2016-03-12 00:59:24 +00:00
+ captureDrops = false;
2015-11-09 06:50:45 +00:00
+
2016-03-12 00:59:24 +00:00
+ if (!net.minecraftforge.common.ForgeHooks.onLivingDrops(this, p_70645_1_, capturedDrops, i, field_70718_bc > 0))
2015-11-09 06:50:45 +00:00
+ {
2016-03-12 00:59:24 +00:00
+ for (EntityItem item : capturedDrops)
+ {
+ field_70170_p.func_72838_d(item);
+ }
2015-11-09 06:50:45 +00:00
+ }
2016-03-12 00:59:24 +00:00
}
2015-11-09 06:50:45 +00:00
2016-03-12 00:59:24 +00:00
this.field_70170_p.func_72960_a(this, (byte)3);
2016-11-13 22:09:54 +00:00
@@ -1215,7 +1229,7 @@
2016-03-12 00:59:24 +00:00
BlockPos blockpos = new BlockPos(i, j, k);
IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos);
Block block = iblockstate.func_177230_c();
- return block != Blocks.field_150468_ap && block != Blocks.field_150395_bd ? block instanceof BlockTrapDoor && this.func_184604_a(blockpos, iblockstate) : true;
+ return net.minecraftforge.common.ForgeHooks.isLivingOnLadder(iblockstate, field_70170_p, new BlockPos(i, j, k), this);
}
2015-11-09 06:50:45 +00:00
}
2016-11-13 22:09:54 +00:00
@@ -1241,6 +1255,9 @@
2015-11-09 06:50:45 +00:00
2015-11-22 05:46:26 +00:00
public void func_180430_e(float p_180430_1_, float p_180430_2_)
2015-11-09 06:50:45 +00:00
{
2015-11-22 05:46:26 +00:00
+ float[] ret = net.minecraftforge.common.ForgeHooks.onLivingFall(this, p_180430_1_, p_180430_2_);
2015-11-09 06:50:45 +00:00
+ if (ret == null) return;
2015-11-22 05:46:26 +00:00
+ p_180430_1_ = ret[0]; p_180430_2_ = ret[1];
super.func_180430_e(p_180430_1_, p_180430_2_);
2016-03-12 00:59:24 +00:00
PotionEffect potioneffect = this.func_70660_b(MobEffects.field_76430_j);
float f = potioneffect == null ? 0.0F : (float)(potioneffect.func_76458_c() + 1);
2016-11-13 22:09:54 +00:00
@@ -1257,7 +1274,7 @@
2016-07-24 16:44:21 +00:00
if (iblockstate.func_185904_a() != Material.field_151579_a)
{
- SoundType soundtype = iblockstate.func_177230_c().func_185467_w();
+ SoundType soundtype = iblockstate.func_177230_c().getSoundType(iblockstate, field_70170_p, new BlockPos(j, k, l), this);
this.func_184185_a(soundtype.func_185842_g(), soundtype.func_185843_a() * 0.5F, soundtype.func_185847_b() * 0.75F);
}
}
2016-11-13 22:09:54 +00:00
@@ -1334,6 +1351,8 @@
2015-11-09 06:50:45 +00:00
{
2015-11-22 05:46:26 +00:00
if (!this.func_180431_b(p_70665_1_))
2015-11-09 06:50:45 +00:00
{
2015-11-22 05:46:26 +00:00
+ p_70665_2_ = net.minecraftforge.common.ForgeHooks.onLivingHurt(this, p_70665_1_, p_70665_2_);
+ if (p_70665_2_ <= 0) return;
p_70665_2_ = this.func_70655_b(p_70665_1_, p_70665_2_);
p_70665_2_ = this.func_70672_c(p_70665_1_, p_70665_2_);
float f = p_70665_2_;
2016-11-13 22:09:54 +00:00
@@ -1383,6 +1402,11 @@
2015-11-09 06:50:45 +00:00
2016-03-12 00:59:24 +00:00
public void func_184609_a(EnumHand p_184609_1_)
2015-11-09 06:50:45 +00:00
{
2016-03-12 00:59:24 +00:00
+ ItemStack stack = this.func_184586_b(p_184609_1_);
2015-11-22 05:46:26 +00:00
+ if (stack != null && stack.func_77973_b() != null)
2015-11-09 06:50:45 +00:00
+ {
2015-11-22 05:46:26 +00:00
+ if (stack.func_77973_b().onEntitySwing(this, stack)) return;
2015-11-09 06:50:45 +00:00
+ }
2015-11-22 05:46:26 +00:00
if (!this.field_82175_bq || this.field_110158_av >= this.func_82166_i() / 2 || this.field_110158_av < 0)
2015-11-09 06:50:45 +00:00
{
2015-11-22 05:46:26 +00:00
this.field_110158_av = -1;
2016-11-13 22:09:54 +00:00
@@ -1613,7 +1637,7 @@
2016-03-12 00:59:24 +00:00
2016-11-13 22:09:54 +00:00
if (!this.field_70170_p.func_184143_b(axisalignedbb1))
2016-03-12 00:59:24 +00:00
{
2016-11-13 22:09:54 +00:00
- if (this.field_70170_p.func_180495_p(new BlockPos(d11, this.field_70163_u, d12)).func_185896_q())
+ if (this.field_70170_p.func_180495_p(new BlockPos(d11, this.field_70163_u, d12)).isSideSolid(field_70170_p, new BlockPos(d11, this.field_70163_u, d12), EnumFacing.UP))
{
this.func_70634_a(d11, this.field_70163_u + 1.0D, d12);
return;
@@ -1621,14 +1645,14 @@
2016-03-12 00:59:24 +00:00
2016-11-13 22:09:54 +00:00
BlockPos blockpos = new BlockPos(d11, this.field_70163_u - 1.0D, d12);
2016-03-12 00:59:24 +00:00
2016-11-13 22:09:54 +00:00
- if (this.field_70170_p.func_180495_p(blockpos).func_185896_q() || this.field_70170_p.func_180495_p(blockpos).func_185904_a() == Material.field_151586_h)
+ if (this.field_70170_p.func_180495_p(blockpos).isSideSolid(field_70170_p, blockpos, EnumFacing.UP) || this.field_70170_p.func_180495_p(blockpos).func_185904_a() == Material.field_151586_h)
{
d1 = d11;
d13 = this.field_70163_u + 1.0D;
d14 = d12;
}
}
- else if (!this.field_70170_p.func_184143_b(axisalignedbb1.func_72317_d(0.0D, 1.0D, 0.0D)) && this.field_70170_p.func_180495_p(new BlockPos(d11, this.field_70163_u + 1.0D, d12)).func_185896_q())
+ else if (!this.field_70170_p.func_184143_b(axisalignedbb1.func_72317_d(0.0D, 1.0D, 0.0D)) && this.field_70170_p.func_180495_p(new BlockPos(d11, this.field_70163_u + 1.0D, d12)).isSideSolid(field_70170_p, new BlockPos(d11, this.field_70163_u + 1.0D, d12), EnumFacing.UP))
2016-03-12 00:59:24 +00:00
{
d1 = d11;
2016-11-13 22:09:54 +00:00
d13 = this.field_70163_u + 2.0D;
@@ -1700,6 +1724,7 @@
2015-11-09 06:50:45 +00:00
}
2015-11-22 05:46:26 +00:00
this.field_70160_al = true;
2015-11-09 06:50:45 +00:00
+ net.minecraftforge.common.ForgeHooks.onLivingJump(this);
}
2015-11-22 05:46:26 +00:00
protected void func_70629_bd()
2016-11-13 22:09:54 +00:00
@@ -1972,6 +1997,7 @@
2015-11-09 06:50:45 +00:00
2015-11-22 05:46:26 +00:00
public void func_70071_h_()
2015-11-09 06:50:45 +00:00
{
+ if (net.minecraftforge.common.ForgeHooks.onLivingUpdate(this)) return;
2015-11-22 05:46:26 +00:00
super.func_70071_h_();
2016-03-12 00:59:24 +00:00
this.func_184608_ct();
2015-11-09 06:50:45 +00:00
2016-11-13 22:09:54 +00:00
@@ -2488,6 +2514,40 @@
2015-11-22 05:46:26 +00:00
this.field_70752_e = true;
2015-11-09 06:50:45 +00:00
}
2016-03-12 00:59:24 +00:00
2015-11-09 06:50:45 +00:00
+ /***
+ * Removes all potion effects that have curativeItem as a curative item for its effect
+ * @param curativeItem The itemstack we are using to cure potion effects
+ */
+ public void curePotionEffects(ItemStack curativeItem)
+ {
2015-11-22 05:46:26 +00:00
+ if (field_70170_p.field_72995_K) return;
2016-03-12 00:59:24 +00:00
+ Iterator<PotionEffect> iterator = this.field_70713_bf.values().iterator();
2015-11-09 06:50:45 +00:00
+
2016-03-12 00:59:24 +00:00
+ while (iterator.hasNext())
2015-11-09 06:50:45 +00:00
+ {
2016-03-12 00:59:24 +00:00
+ PotionEffect effect = iterator.next();
2015-11-09 06:50:45 +00:00
+
+ if (effect.isCurativeItem(curativeItem))
+ {
2015-11-22 05:46:26 +00:00
+ func_70688_c(effect);
2016-03-12 00:59:24 +00:00
+ iterator.remove();
2015-11-22 05:46:26 +00:00
+ this.field_70752_e = true;
2015-11-09 06:50:45 +00:00
+ }
+ }
+ }
+
+ /**
+ * Returns true if the entity's rider (EntityPlayer) should face forward when mounted.
+ * currently only used in vanilla code by pigs.
+ *
+ * @param player The player who is riding the entity.
+ * @return If the player should orient the same direction as this entity.
+ */
+ public boolean shouldRiderFaceForward(EntityPlayer player)
+ {
+ return this instanceof net.minecraft.entity.passive.EntityPig;
+ }
2016-03-12 00:59:24 +00:00
+
public abstract EnumHandSide func_184591_cq();
public boolean func_184587_cr()
2016-11-13 22:09:54 +00:00
@@ -2508,12 +2568,19 @@
2016-03-12 00:59:24 +00:00
2016-05-05 05:29:00 +00:00
if (itemstack == this.field_184627_bm)
2016-03-12 00:59:24 +00:00
{
2016-05-05 05:29:00 +00:00
+ if (this.field_184627_bm != null)
2016-03-12 00:59:24 +00:00
+ {
2016-05-05 05:29:00 +00:00
+ field_184628_bn = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, field_184627_bm, field_184628_bn);
+ if (field_184628_bn > 0)
+ field_184627_bm.func_77973_b().onUsingTick(field_184627_bm, this, field_184628_bn);
2016-03-12 00:59:24 +00:00
+ }
2016-05-05 05:29:00 +00:00
+
2016-03-12 00:59:24 +00:00
if (this.func_184605_cv() <= 25 && this.func_184605_cv() % 4 == 0)
{
this.func_184584_a(this.field_184627_bm, 5);
2016-05-05 05:29:00 +00:00
}
- if (--this.field_184628_bn == 0 && !this.field_70170_p.field_72995_K)
+ if (--this.field_184628_bn <= 0 && !this.field_70170_p.field_72995_K)
2016-03-12 00:59:24 +00:00
{
this.func_71036_o();
}
2016-11-13 22:09:54 +00:00
@@ -2531,8 +2598,10 @@
2016-03-12 00:59:24 +00:00
2016-11-13 22:09:54 +00:00
if (!itemstack.func_190926_b() && !this.func_184587_cr())
2016-03-12 00:59:24 +00:00
{
+ int duration = net.minecraftforge.event.ForgeEventFactory.onItemUseStart(this, itemstack, itemstack.func_77988_m());
+ if (duration <= 0) return;
this.field_184627_bm = itemstack;
- this.field_184628_bn = itemstack.func_77988_m();
+ this.field_184628_bn = duration;
if (!this.field_70170_p.field_72995_K)
{
2016-11-13 22:09:54 +00:00
@@ -2613,7 +2682,9 @@
if (!this.field_184627_bm.func_190926_b() && this.func_184587_cr())
{
2016-03-12 00:59:24 +00:00
this.func_184584_a(this.field_184627_bm, 16);
2016-11-13 22:09:54 +00:00
- this.func_184611_a(this.func_184600_cs(), this.field_184627_bm.func_77950_b(this.field_70170_p, this));
+ ItemStack itemstack = this.field_184627_bm.func_77950_b(this.field_70170_p, this);
2016-03-12 00:59:24 +00:00
+ itemstack = net.minecraftforge.event.ForgeEventFactory.onItemUseFinish(this, field_184627_bm, func_184605_cv(), itemstack);
2016-11-13 22:09:54 +00:00
+ this.func_184611_a(this.func_184600_cs(), itemstack);
this.func_184602_cy();
}
}
@@ -2637,7 +2708,8 @@
2016-03-17 01:25:14 +00:00
{
2016-11-13 22:09:54 +00:00
if (!this.field_184627_bm.func_190926_b())
2016-03-12 00:59:24 +00:00
{
2016-03-17 01:25:14 +00:00
- this.field_184627_bm.func_77974_b(this.field_70170_p, this, this.func_184605_cv());
2016-03-12 00:59:24 +00:00
+ if (!net.minecraftforge.event.ForgeEventFactory.onUseItemStop(this, field_184627_bm, this.func_184605_cv()))
+ this.field_184627_bm.func_77974_b(this.field_70170_p, this, this.func_184605_cv());
}
this.func_184602_cy();
2016-11-17 18:44:31 +00:00
@@ -2761,4 +2833,29 @@
2016-03-21 14:24:36 +00:00
{
return true;
}
+
+ // FORGE
+ private final net.minecraftforge.items.IItemHandlerModifiable handHandler = new net.minecraftforge.items.ItemStackHandler(field_184630_bs);
+ private final net.minecraftforge.items.IItemHandlerModifiable armorHandler = new net.minecraftforge.items.ItemStackHandler(field_184631_bt);
+ private final net.minecraftforge.items.IItemHandler joinedHandler = new net.minecraftforge.items.wrapper.CombinedInvWrapper(armorHandler, handHandler);
+
2016-03-22 06:01:00 +00:00
+ @SuppressWarnings("unchecked")
2016-03-21 14:24:36 +00:00
+ @Override
2016-11-17 18:44:31 +00:00
+ @Nullable
+ public <T> T getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable net.minecraft.util.EnumFacing facing)
2016-03-21 14:24:36 +00:00
+ {
+ if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
+ {
2016-03-22 01:31:33 +00:00
+ if (facing == null) return (T) joinedHandler;
+ else if (facing.func_176740_k().func_176720_b()) return (T) handHandler;
+ else if (facing.func_176740_k().func_176722_c()) return (T) armorHandler;
2016-03-21 14:24:36 +00:00
+ }
+ return super.getCapability(capability, facing);
+ }
+
+ @Override
2016-11-17 18:44:31 +00:00
+ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability<?> capability, @Nullable net.minecraft.util.EnumFacing facing)
2016-03-21 14:24:36 +00:00
+ {
+ return capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing);
+ }
}