When this method is called (by the builder from RFTools Builder for example) the BlockItemUseContext never receive the ItemStack being placed.
So when BlockItem#place is called the BlockItem has no way to know exactly what ItemStack is being placed, this cause issues when the placed block depends on the nbt of the ItemStack.
|
public static BlockState placeStackAt(PlayerEntity player, ItemStack blockStack, World world, BlockPos pos, @Nullable BlockState origState) { |
|
BlockRayTraceResult trace = new BlockRayTraceResult(new Vector3d(0, 0, 0), Direction.UP, pos, false); |
|
BlockItemUseContext context = new BlockItemUseContext(new ItemUseContext(player, Hand.MAIN_HAND, trace)); |
|
if (blockStack.getItem() instanceof BlockItem) { |
|
BlockItem itemBlock = (BlockItem) blockStack.getItem(); |
|
if (origState == null) { |
|
origState = itemBlock.getBlock().getStateForPlacement(context); |
|
if (origState == null) { |
|
// Cannot place! |
|
return null; |
|
} |
|
} |
|
if (itemBlock.place(context).consumesAction()) { |
|
blockStack.shrink(1); |
|
} |
|
return origState; |
|
} else { |
Suggested fix : Pass the ItemStack to the BlockItemUseContext or at least set it to the Player's main hand. (or both)
When this method is called (by the builder from RFTools Builder for example) the BlockItemUseContext never receive the ItemStack being placed.
So when BlockItem#place is called the BlockItem has no way to know exactly what ItemStack is being placed, this cause issues when the placed block depends on the nbt of the ItemStack.
McJtyLib/src/main/java/mcjty/lib/varia/Tools.java
Lines 75 to 91 in c40223b
Suggested fix : Pass the ItemStack to the BlockItemUseContext or at least set it to the Player's main hand. (or both)