ForgePatch/patches_old_unknown/ItemBlock.java.patch

66 lines
3.5 KiB
Diff
Raw Normal View History

--- ../src-base/minecraft/net/minecraft/item/ItemBlock.java
+++ ../src-work/minecraft/net/minecraft/item/ItemBlock.java
@@ -49,24 +49,12 @@
if (!itemstack.func_190926_b() && p_180614_1_.func_175151_a(p_180614_3_, p_180614_5_, itemstack) && p_180614_2_.func_190527_a(this.field_150939_a, p_180614_3_, false, p_180614_5_, (Entity)null))
{
int i = this.func_77647_b(itemstack.func_77960_j());
- IBlockState iblockstate1 = this.field_150939_a.func_180642_a(p_180614_2_, p_180614_3_, p_180614_5_, p_180614_6_, p_180614_7_, p_180614_8_, i, p_180614_1_);
+ IBlockState iblockstate1 = this.field_150939_a.getStateForPlacement(p_180614_2_, p_180614_3_, p_180614_5_, p_180614_6_, p_180614_7_, p_180614_8_, i, p_180614_1_, p_180614_4_);
- if (p_180614_2_.func_180501_a(p_180614_3_, iblockstate1, 11))
+ if (placeBlockAt(itemstack, p_180614_1_, p_180614_2_, p_180614_3_, p_180614_5_, p_180614_6_, p_180614_7_, p_180614_8_, iblockstate1))
{
iblockstate1 = p_180614_2_.func_180495_p(p_180614_3_);
-
- if (iblockstate1.func_177230_c() == this.field_150939_a)
- {
- func_179224_a(p_180614_2_, p_180614_1_, p_180614_3_, itemstack);
- this.field_150939_a.func_180633_a(p_180614_2_, p_180614_3_, iblockstate1, p_180614_1_, itemstack);
-
- if (p_180614_1_ instanceof EntityPlayerMP)
- {
- CriteriaTriggers.field_193137_x.func_193173_a((EntityPlayerMP)p_180614_1_, p_180614_3_, itemstack);
- }
- }
-
- SoundType soundtype = this.field_150939_a.func_185467_w();
+ SoundType soundtype = iblockstate1.func_177230_c().getSoundType(iblockstate1, p_180614_2_, p_180614_3_, p_180614_1_);
p_180614_2_.func_184133_a(p_180614_1_, p_180614_3_, soundtype.func_185841_e(), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 2.0F, soundtype.func_185847_b() * 0.8F);
itemstack.func_190918_g(1);
}
@@ -127,7 +115,7 @@
{
Block block = p_179222_1_.func_180495_p(p_179222_2_).func_177230_c();
- if (block == Blocks.field_150431_aC)
+ if (block == Blocks.field_150431_aC && block.func_176200_f(p_179222_1_, p_179222_2_))
{
p_179222_3_ = EnumFacing.UP;
}
@@ -171,6 +159,36 @@
+ /**
+ * Called to actually place the block, after the location is determined
+ * and all permission checks have been made.
+ *
+ * @param stack The item stack that was used to place the block. This can be changed inside the method.
+ * @param player The player who is placing the block. Can be null if the block is not being placed by a player.
+ * @param side The side the player (or machine) right-clicked on.
+ */
+ public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, IBlockState newState)
+ {
+ if (!world.func_180501_a(pos, newState, 11)) return false;
+
+ IBlockState state = world.func_180495_p(pos);
+ if (state.func_177230_c() == this.field_150939_a)
+ {
+ func_179224_a(world, player, pos, stack);
+ this.field_150939_a.func_180633_a(world, pos, state, player, stack);
+
+ if (player instanceof EntityPlayerMP)
+ CriteriaTriggers.field_193137_x.func_193173_a((EntityPlayerMP)player, pos, stack);
+ }
+
+ return true;
+ }
}