ForgePatch/patches/minecraft/net/minecraft/item/BlockItem.java.patch

50 lines
2.0 KiB
Diff

--- a/net/minecraft/item/BlockItem.java
+++ b/net/minecraft/item/BlockItem.java
@@ -69,8 +69,8 @@
}
}
- SoundType soundtype = blockstate1.func_215695_r();
- world.func_184133_a(playerentity, blockpos, this.func_219983_a(blockstate1), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 2.0F, soundtype.func_185847_b() * 0.8F);
+ SoundType soundtype = blockstate1.getSoundType(world, blockpos, p_195942_1_.func_195999_j());
+ world.func_184133_a(playerentity, blockpos, this.getPlaceSound(blockstate1, world, blockpos, p_195942_1_.func_195999_j()), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 2.0F, soundtype.func_185847_b() * 0.8F);
if (playerentity == null || !playerentity.field_71075_bZ.field_75098_d) {
itemstack.func_190918_g(1);
}
@@ -81,10 +81,16 @@
}
}
+ @Deprecated //Forge: Use more sensitive version {@link BlockItem#getPlaceSound(BlockState, IBlockReader, BlockPos, Entity) }
protected SoundEvent func_219983_a(BlockState p_219983_1_) {
return p_219983_1_.func_215695_r().func_185841_e();
}
+ //Forge: Sensitive version of BlockItem#getPlaceSound
+ protected SoundEvent getPlaceSound(BlockState state, World world, BlockPos pos, PlayerEntity entity) {
+ return state.getSoundType(world, pos, entity).func_185841_e();
+ }
+
@Nullable
public BlockItemUseContext func_219984_b(BlockItemUseContext p_219984_1_) {
return p_219984_1_;
@@ -192,10 +198,18 @@
}
public Block func_179223_d() {
+ return this.getBlockRaw() == null ? null : this.getBlockRaw().delegate.get();
+ }
+
+ private Block getBlockRaw() {
return this.field_150939_a;
}
public void func_195946_a(Map<Block, Item> p_195946_1_, Item p_195946_2_) {
p_195946_1_.put(this.func_179223_d(), p_195946_2_);
}
+
+ public void removeFromBlockToItemMap(Map<Block, Item> blockToItemMap, Item itemIn) {
+ blockToItemMap.remove(this.func_179223_d());
+ }
}