src/main/java/com/github/klikli_dev/occultism/util/TileEntityUtil.java
/**
     * Handles the common use case of dropping self with tile entity nbt on block change during replace.
     *
     * @param block    the current block.
     * @param state    the old state.
     * @param world    the world
     * @param pos      the position.
     * @param newState the new state
     */
Handles the common use case of dropping self with tile entity nbt on block change during replace.
@param block    the current block.
@param state    the old state.
@param world    the world
@param pos      the position.
@param newState the new state
Handles the common use case of dropping self with tile entity nbt on block change during replace . @param block the current block . @param state the old state . @param world the world @param pos the position . @param newState the new state
public static void onBlockChangeDropWithNbt(Block block, BlockState state, World world, BlockPos pos,
                                                BlockState newState) {
        if (state.getBlock() != newState.getBlock()) {
            if (!world.isClientSide) {
                TileEntity tile = world.getBlockEntity(pos);
                if (tile != null) {
                    world.addFreshEntity(TileEntityUtil.getDroppedItemWithNbt(new ItemStack(block), tile));
                }
            }
            world.updateNeighbourForOutputSignal(pos, block);
        }
    }
public static void onBlockChangeDropWithNbt ( Block block , BlockState state , World world , BlockPos pos , BlockState newState ) { if ( state . getBlock ( ) != newState . getBlock ( ) ) { if ( ! world . isClientSide ) { TileEntity tile = world . getBlockEntity ( pos ) ; if ( tile != null ) { world . addFreshEntity ( TileEntityUtil . getDroppedItemWithNbt ( new ItemStack ( block ) , tile ) ) ; } } world . updateNeighbourForOutputSignal ( pos , block ) ; } }
Handles the common use case of dropping self with tile entity nbt on block change during replace.
Handles the common use case of dropping self with tile entity nbt on block change during replace .