2929import net .minecraft .world .phys .shapes .CollisionContext ;
3030import net .minecraft .world .phys .shapes .VoxelShape ;
3131import net .neoforged .neoforge .items .IItemHandler ;
32- import net .neoforged .neoforge .items .IItemHandlerModifiable ;
3332import net .neoforged .neoforge .items .ItemStackHandler ;
3433import org .jetbrains .annotations .NotNull ;
3534
@@ -48,22 +47,10 @@ public RollingMillBlock(Properties properties) {
4847
4948 @ Override
5049 protected @ NotNull ItemInteractionResult useItemOn (ItemStack stack , BlockState state , Level level , BlockPos pos , Player player , InteractionHand hand , BlockHitResult hitResult ) {
51- return super .useItemOn (stack , state , level , pos , player , hand , hitResult );
52- }
53-
54- @ Override
55- protected @ NotNull InteractionResult useWithoutItem (BlockState state , Level level , BlockPos pos , Player player , BlockHitResult hitResult ) {
56- return InteractionResult .PASS ;
57- }
58-
59- @ Override
60- public InteractionResult use (BlockState state , Level worldIn , BlockPos pos , Player player , InteractionHand handIn , BlockHitResult hit ) {
61- if (!player .getItemInHand (handIn ).isEmpty ()) return InteractionResult .PASS ;
62- if (worldIn .isClientSide ) return InteractionResult .SUCCESS ;
63-
64- withBlockEntityDo (worldIn , pos , rollingMill -> {
50+ if (level .isClientSide ) return ItemInteractionResult .SUCCESS ;
51+ withBlockEntityDo (level , pos , rollingMill -> {
6552 boolean emptyOutput = true ;
66- IItemHandlerModifiable inv = rollingMill .outputInv ;
53+ ItemStackHandler inv = rollingMill .outputInv ;
6754 for (int slot = 0 ; slot < inv .getSlots (); slot ++) {
6855 ItemStack stackInSlot = inv .getStackInSlot (slot );
6956 if (!stackInSlot .isEmpty ())
@@ -84,7 +71,13 @@ public InteractionResult use(BlockState state, Level worldIn, BlockPos pos, Play
8471 rollingMill .sendData ();
8572 });
8673
87- return InteractionResult .SUCCESS ;
74+ return ItemInteractionResult .SUCCESS ;
75+ }
76+
77+ @ Override
78+ protected @ NotNull InteractionResult useWithoutItem (BlockState state , Level level , BlockPos pos , Player player , BlockHitResult hitResult ) {
79+ if (level .isClientSide ) return InteractionResult .SUCCESS ;
80+ return InteractionResult .PASS ;
8881 }
8982
9083 @ Override
0 commit comments