[1.12] Check both hands for sneak interaction bypass (#4256)

This commit is contained in:
Erlend Åmdal authored and LexManos committed 2017-10-02 16:28:34 -07:00
1 parent 6956df4ff2
commit 025495f98b
3 files changed
+17 -3

No files matched your search

@@ -129,7 +129,7 @@
+ }
+
IBlockState iblockstate = p_187099_2_.func_180495_p(p_187099_3_);
+ boolean bypass = itemstack.func_190926_b() || itemstack.func_77973_b().doesSneakBypassUse(itemstack, p_187099_2_, p_187099_3_, p_187099_1_);
+ boolean bypass = p_187099_1_.func_184614_ca().doesSneakBypassUse(p_187099_2_, p_187099_3_, p_187099_1_) && p_187099_1_.func_184592_cb().doesSneakBypassUse(p_187099_2_, p_187099_3_, p_187099_1_);
- if ((!p_187099_1_.func_70093_af() || p_187099_1_.func_184614_ca().func_190926_b() && p_187099_1_.func_184592_cb().func_190926_b()) && iblockstate.func_177230_c().func_180639_a(p_187099_2_, p_187099_3_, iblockstate, p_187099_1_, p_187099_6_, p_187099_4_, f, f1, f2))
+ if ((!p_187099_1_.func_70093_af() || bypass || event.getUseBlock() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW))
@@ -232,7 +232,7 @@
}
return multimap;
@@ -1130,4 +1155,113 @@
@@ -1130,4 +1155,127 @@
{
this.func_190917_f(-p_190918_1_);
}
@@ -344,5 +344,19 @@
+ return shareTagB == null;
+ else
+ return shareTagB != null && shareTagA.equals(shareTagB);
+ }
+
+ /**
+ *
+ * Should this item, when held, allow sneak-clicks to pass through to the underlying block?
+ *
+ * @param world The world
+ * @param pos Block position in world
+ * @param player The Player that is wielding the item
+ * @return
+ */
+ public boolean doesSneakBypassUse(net.minecraft.world.IBlockAccess world, BlockPos pos, EntityPlayer player)
+ {
+ return this.func_190926_b() || this.func_77973_b().doesSneakBypassUse(this, world, pos, player);
+ }
}
@@ -232,7 +232,7 @@
+ EnumActionResult ret = p_187251_3_.onItemUseFirst(p_187251_1_, p_187251_2_, p_187251_5_, p_187251_4_, p_187251_6_, p_187251_7_, p_187251_8_, p_187251_9_);
+ if (ret != EnumActionResult.PASS) return ret;
+
+ boolean bypass = p_187251_3_.func_190926_b() || p_187251_3_.func_77973_b().doesSneakBypassUse(p_187251_3_, p_187251_2_, p_187251_5_, p_187251_1_);
+ boolean bypass = p_187251_1_.func_184614_ca().doesSneakBypassUse(p_187251_2_, p_187251_5_, p_187251_1_) && p_187251_1_.func_184592_cb().doesSneakBypassUse(p_187251_2_, p_187251_5_, p_187251_1_);
+ EnumActionResult result = EnumActionResult.PASS;
+
+ if (!p_187251_1_.func_70093_af() || bypass || event.getUseBlock() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW)