Files
CatServer/patches/net/minecraft/item/ItemBlockSpecial.java.patch
2019-08-06 04:32:24 +08:00

48 lines
1.8 KiB
Diff

--- ../src-base/minecraft/net/minecraft/item/ItemBlockSpecial.java
+++ ../src-work/minecraft/net/minecraft/item/ItemBlockSpecial.java
@@ -18,7 +18,7 @@
public class ItemBlockSpecial extends Item
{
- private final Block block;
+ public final Block block;
public ItemBlockSpecial(Block block)
{
@@ -41,9 +41,9 @@
ItemStack itemstack = player.getHeldItem(hand);
- if (!itemstack.isEmpty() && player.canPlayerEdit(pos, facing, itemstack) && worldIn.mayPlace(this.block, pos, false, facing, (Entity)null))
+ if (!itemstack.isEmpty() && player.canPlayerEdit(pos, facing, itemstack) && worldIn.mayPlace(this.block, pos, false, facing, player))
{
- IBlockState iblockstate1 = this.block.getStateForPlacement(worldIn, pos, facing, hitX, hitY, hitZ, 0, player);
+ IBlockState iblockstate1 = this.block.getStateForPlacement(worldIn, pos, facing, hitX, hitY, hitZ, 0, player, hand);
if (!worldIn.setBlockState(pos, iblockstate1, 11))
{
@@ -64,7 +64,7 @@
}
}
- SoundType soundtype = this.block.getSoundType();
+ SoundType soundtype = iblockstate1.getBlock().getSoundType(iblockstate1, worldIn, pos, player);
worldIn.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
itemstack.shrink(1);
return EnumActionResult.SUCCESS;
@@ -75,4 +75,14 @@
return EnumActionResult.FAIL;
}
}
+
+ public Block getBlock()
+ {
+ return this.getBlockRaw() == null ? null : this.getBlockRaw().delegate.get();
+ }
+
+ private Block getBlockRaw()
+ {
+ return this.block;
+ }
}